49,761 Topics

Member Avatar for
Member Avatar for juman2010
Member Avatar for NathanOliver
0
307
Member Avatar for wilsonz91

Hi, I recently bought a book-The Complete Reference C++ by Herbert Schildt. The first part explains about the similarities about C++ and C. The syntax used is different from the one my lecturer is teaching. eg: cout<< is replaced by printf cin>> is replaced by scanf I would like to …

Member Avatar for wilsonz91
1
194
Member Avatar for MatthewSedam

This is a Brain Tester that I made. [CODE] #include <iostream> #include <ctime> using namespace std; int main() { for (int a=0,b=1;a!=b;) { cout << "This is a Brain Tester Program Made By Matthew Sedam.\n"; cout << "Select An Option.\n" << "1 - Multiplication\n2 - Division\n"; int select; cin >> …

Member Avatar for mrnutty
0
185
Member Avatar for mswezey

Hello this is for my assignment for college. I just need help on how to properly declare ofstream/ifstream globally to get my program to work the proper way. Yes I know I can just declare it in Main() and use pass by reference. ( Did that on the first project …

Member Avatar for mswezey
0
3K
Member Avatar for bbabarajj

How to add 1/1+ 1/2+1/3...+1/9+1/10 . I tried but I am getting answer in negative number.

Member Avatar for bbabarajj
0
2K
Member Avatar for rmrgrs

All might gurus of that which I don't understand- I am a student and I am asking for some homework help (sorry, I am really stuck). I am getting a "C4430: missing type specifier - int assumed. Note: C++ does not support default-int" error, and for the life of me, …

Member Avatar for rmrgrs
0
77
Member Avatar for Metraton

Hello guys! I'm facing a problem with IO using files. Here is the simple code that's kepping me awake: [code]Files::Files() { numbers.open("textfile.txt"); if ( numbers.good() ) { cout << "Object from Files class ok!" << endl; } else { cout << "Object from Files class NOT ok!" << endl; } …

Member Avatar for jonsca
-1
77
Member Avatar for froggy1976

I am creating a program with at least two classes, a base class and a derived class and that includes the following: a composite object an example of inheritance at least one virtual and at least one pure virtual function at least one overloaded function at least one example of …

Member Avatar for jonsca
0
146
Member Avatar for mikabark

I hope to copy from container to another container. But it is not easy. gdb said I'm trying to copy const string to string. --------------------------------------------------------------------------------- 0x00007ffff7b760f3 in std::string::assign(std::string const&) () from /usr/lib/libstdc++.so.6 --------------------------------------------------------------------------------- I don't know how to copy from container to container one by one. WiIl you help me? …

Member Avatar for mikabark
0
149
Member Avatar for invisi

:) My mind went blank for a bit and I couldn't figure out such a simple programme. But then I had a shower and all was well :) [CODE]#include <iostream> #include <string> #include <cmath> using namespace std; int factorial(int i = 1); int main() { int num = 0; bool …

Member Avatar for vmanes
0
72
Member Avatar for cthreash

I have a question regarding scope for a character array defined as follows: saveDataObj->save("This is the first entry", 1, 2); Here is how the SaveData class has been defined: [code=c++] class SaveData { struct entry{ const char* data; int data1; } entry* mpData; static int iter; } //Constructor SaveData::SaveData() { …

Member Avatar for cthreash
0
388
Member Avatar for Dewey1040

I wrote a program to compare two text files character by character and its not working probably an easy thing im just not seeing. [code=c++] #include <iostream> #include <fstream> #include <string> using namespace std; int main(int argc, char *argv[]){ string s1; string s2; char c1, c2; if(argc !=3) { // …

Member Avatar for WaltP
0
176
Member Avatar for shankhs

Hi, I am using C/C++ for 4 years now,solving algorithmic problems only. I see many softwares that do fancy stuffs like windows softwares which automate the installation process , move the mouse automatically and buttons are clicked. Please can anyone tell me what programming language is used in such cases? …

Member Avatar for tkud
0
609
Member Avatar for soapyillusion

Hey guys Ive been working on this problem for standard deviation, and so far ive got it all right accept my declaration in this module, was wondering if anyone can help me see whats wrong with my formula or the decelerations i have made Here is the code for my …

Member Avatar for dusktreader
0
162
Member Avatar for JeyC

In the following program, I am defining two global arrays A and B of length 3 each. In my program, I am outputting the first A[0], A[1], A[2] and A[3]. Note . A[3] does not exist, so I expected the program to output an error or say 1e291 or something …

Member Avatar for dusktreader
0
77
Member Avatar for Anarionist

What I am trying to do is compare the contents of array s to the string name (for a filter) but it just continues and prints whatever goes through. I think the problem is with my if statement but I have tried everything that I thought was valid code. [CODE]#include …

Member Avatar for dusktreader
0
139
Member Avatar for balanel

hi how can i convert a string for example "01020304" to "\x01\x02\x03\x04" ? 10x

Member Avatar for dusktreader
0
35
Member Avatar for sdgz747

I am supposed to write a program that asks for the coefficients a, b, and c of a quadratic equation ax2+bx+c=0. It needs to display to the screen one of the following: • two distinct real numbers (when b2-4ac > 0), • two distinct complex numbers (when b2-4ac < 0), …

Member Avatar for abhimanipal
0
1K
Member Avatar for binay2

Hello! So , I got a weird problem.In my code the value of the char N[cn] is ignored when I compare it to a constant value. Here's the code: Code: [code] for ( i = 1; i <= 220; i++ ){ // Generate Numbers itoa (i,Number, (V+1)); sscanf(Number, "%d", &ii); …

Member Avatar for binay2
0
329
Member Avatar for mikabark

I will copy stl vector container A to B But not whole. If element of A is proper, I will copy only that to B. Is there any way to do it? I tried to do this way. 1. newA.put_dat(input_stl[j].ino_no) -------- ------------------------ B con A container (ino_no element or whatever) …

Member Avatar for mikabark
0
324
Member Avatar for invisi

Why cant I pass variables into a void printPoint function, and not have to return a float ave. I tried just printing the coordinates but I got too errors. so my function looked like this [CODE]void printPoint(float x , float y, float z){ cout << " < " << x …

Member Avatar for invisi
0
98
Member Avatar for hax-

Hey, I am currently using code::blocks and I am basically creating everything by hand here (dialogs and all) I just need to know how I might go about loading up a dialog that I have created in my .rc (that is, getting it to pop up when I click a …

Member Avatar for mitrmkar
0
138
Member Avatar for iammfa

Hi all, Now, I'm trying practice on c++ basics, since few minutes I tried practice "library functions" especially "sin" function, I wrote this trivial program to calculate angle in console screen, but when I input 90 degree it gave me 0.8939, but with calculator it gave me 1, why console …

Member Avatar for Stefano Mtangoo
0
138
Member Avatar for Argo54325

Hello, I've been looking for information on creating a chat server and client application, just the basics that would include: 1. Connecting to the server. 2. Displaying a "friends list" (like windows live). 3. Open a private conversation with a friend on the list. 4. Send messages from users to …

Member Avatar for csmgsarma
0
159
Member Avatar for Stefano Mtangoo

Hi all, I have been looking for single function to split strings and seems to me either is not available or I miss it. So I please, help me to know if it is available and if yes where can I get it. Thanks

Member Avatar for jBat
0
92
Member Avatar for 0xe9

Hi, OS: Windows. Language: C++ Say you have a program that connects to an FTP server. Then in the process of transferring a file, you simply hit "Ctrl+c", then the connection drops, as a result WSACleanup i'm guessing is not called, etc. Basically i want to simulate the event of …

Member Avatar for mitrmkar
0
64
Member Avatar for tformed

Hello, I am a new member to this forum. I have some announcements, I will continue to read some more. I need to create a program were the user inputs a number, program displays the cube root for that number. The code I got thusfar is: [CODE][COLOR=#0000ff] #include[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]<stdio.h> [/COLOR][COLOR=#0000ff]#include[/COLOR][COLOR=#000000] …

Member Avatar for NathanOliver
0
694
Member Avatar for Slacked

Hi, I'm trying to create a pretty basic fancy string output, [CODE] #include <iostream> #include <cstring> #include <stdlib.h> using namespace std; int main() { char output[] = "Hello there world"; int len = strlen(output); for (int i = 0; i < len; i++) { cout << output[i]; system("sleep 0.1"); } …

Member Avatar for Slacked
0
154
Member Avatar for PDB1982

I'm trying to find a set of random numbers between 1 and 365, so I tried to use: [code]DayOfBirth = rand() % 365 + 1;[/code] But, I've been told that srand() will produce a better random number, is this true? How do I use it for this instance?

Member Avatar for mrnutty
0
456
Member Avatar for jangozo

Hello, I'm trying to make my code work with -Wall -Werror flags but I get the above error (error: array subscript has type char). Here is the code, which works if these flags are not set. The code is meant to check whether the first character from text is blank …

Member Avatar for jangozo
0
416

The End.