Archived

This topic is now archived and is closed to further replies.

caffeineaddict

Having trouble

Recommended Posts

caffeineaddict    633
It''s been a long while since i made text apps, but i needed to make a console app for a tool, i wanted to make a program to put all the entries into a file so i can view them easy. well this was my first time using msvc++ for a compiler doing console apps, i want to return to the function to allow you to keep inputting records, but when i do it displays infinitly the output text for the main function: i''ll post the code. If you see of any reason it is doing or not doing right, please let me know. #include #include #include #include int main() { ofstream records("record.txt", ios::app); char record[13]; cout<<"Enter new record: "; cin.get(record, 13); records<

Share this post


Link to post
Share on other sites
Dark Star    100
One question:

What does this mean:

  
records <main();


?


Could u explain what you are trying to do, I can't really understand the situation.


Dark Star
UK

Edited by - Dark Star on August 4, 2001 6:43:21 AM

Share this post


Link to post
Share on other sites
caffeineaddict    633
sorry about that, it got messed up when i posted it, it shouldn't be like that. it should be like this...


int main()
{
ofstream records("record.txt", ios::app);
char record[13];
cout<<"Enter new record: ";
cin.get(record, 13);

records<
main();
}
hope it shows up right
sorry it's still messed up, how do you do the little code blocks?

Edited by - caffeineaddict on August 4, 2001 4:26:05 PM

Edited by - caffeineaddict on August 4, 2001 4:27:48 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Here.. try this:
  
int main()
{
ofstream records("record.txt", ios::app);
char record[13];
do{
cout<<"Enter new record: ";
cin >> record;
records<<record<<endl;
} while(record[0] != ''Q'');
return 0;
}

Share this post


Link to post
Share on other sites