No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
11 Posted Topics
I have the following code which basically acts as a typewriter: [code] int main () { char c; puts ("Enter text:"); do { c=getchar(); putchar (c); } while (!feof(stdin)); return 0; } [/code] However when I feed it a text file for input: [icode]$ ./typewriter < input.txt[/icode] it always adds …
Why do you want to do that? The name of the object is arbitrary, it's the data inside that is important.
In my program I am creating a class instance then writing it to a binary file. I do this several times so I have several instances of this class in my file. Then I want to access them individually, read them back into an instance in the program, change its …
niek_e is correct about the second equation having r = 10. I didn't see anyone give a correct answer for the first, so I will: r = 19/3. [QUOTE=niek_e;1023999]You shouldn't drink and drive and you should smoke and do math. That's how people come up with stuff like the Large …
I have a templated class set up like so: [code=CPP] template<typename T> class treeNode { public: bool operator==(const treeNode<T>&) const; bool operator>(const treeNode<T>&) const; void print(); T field; int key; }; [/code] Using the > operator as an example of my problem, I have it overloaded like this: [code=CPP] template<typename …
[url]http://www.daniweb.com/forums/post1021268.html#post1021268[/url] That post describes how to verify that input is an integer. It takes a user inputted string and looks at each character, one at a time, to make sure it's either an integer (0-9) or the '-' character. Maybe that will help.
My code so far opens a text file in a particular format and reads in the data into a structure called salesRecord. There is no problem there. The problem arises when I write the data to a new binary file. Here is the structure: [code=CPP] struct salesRecord { int custNo; …
I'm not exactly sure about CurveLab, but in response to the thread subject there are a few C++ compilers out there for OSX. I use XCode, it comes on your OSX install disc.
After you fixed your "for" loop I don't see a problem... other than in C++ the main function needs to have an integer return type.
Hello again. I was shown this small piece of code when making a command-line based menu, where you enter a number to perform a certain function. [code] while (true) { displayMenu(); if(!(cin >> key)) { if(!cin.eof()) { cin.clear(); cin >> dump; } continue; } // etc [/code] I cut the …
I tried searching the forum, but I couldn't find any threads that really dealt with what I'm trying to do here. I have a struct set up with three fields (shown below). [code] struct StudentInfo { char id[10]; double mark; char grade; }; [/code] [I]Note that the id MUST be …
The End.
Reprise