Click here to Skip to main content
15,889,266 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CFont clean-up Pin
CPallini21-May-07 20:57
mveCPallini21-May-07 20:57 
GeneralRe: CFont clean-up Pin
Stephen Hewitt21-May-07 21:05
Stephen Hewitt21-May-07 21:05 
GeneralRe: CFont clean-up Pin
CPallini21-May-07 21:07
mveCPallini21-May-07 21:07 
QuestionLooking for C++ developpers ASAP Pin
Guy Lecomte21-May-07 4:14
Guy Lecomte21-May-07 4:14 
AnswerRe: Looking for C++ developpers ASAP Pin
Tara1421-May-07 4:26
Tara1421-May-07 4:26 
AnswerRe: Looking for C++ developpers ASAP Pin
sthotakura21-May-07 10:47
sthotakura21-May-07 10:47 
QuestionDirectX & problem with multimonitor... Pin
ilFrate21-May-07 3:48
ilFrate21-May-07 3:48 
Questionfinal loop Pin
klutez12321-May-07 3:02
klutez12321-May-07 3:02 
So this is the last loop I need for my project.

I need to open the file LIBRARIANSHAVE347CATS.DAT and send the info to the screen. Then, it has to search through all entered data, and create a new output file called "bigbook.dat" in which all entered books of over 200 pages have all their data sent to the new file.

So far this is what I have:

	struct card_catalogue                //declare a structure then declare all<br />
	{                                    //the varibles needed for the struct<br />
		float dewey;<br />
		string title;<br />
		string author;<br />
		int released;<br />
	    int num_pages;<br />
		enum typeofbook {fiction = 1, nonfiction, reference, pond};<br />
    };<br />
<br />
int main()<br />
{		<br />
	card_catalogue books;<br />
	ofstream outfile;<br />
	int i;		<br />
<br />
<br />
	cout<< "Enter the Dewey Decimal Number please: ";<br />
	cin>> books.dewey;<br />
	cout<< "Enter the Title of the book please: ";<br />
	getline(cin, books.title);<br />
	cin.ignore(80, '\n');<br />
	cout<< "Enter the Author of the book please: ";<br />
	getline(cin, books.author);<br />
	cout<< "Enter the Year of Release please: ";<br />
	cin>> books.released;<br />
	cout<< "Enter the Number of Pages please: ";<br />
	cin>> books.num_pages;<br />
	cout<< "<-----Type----->"<<endl;	<br />
	cout<<"1 - Fiction" <<endl<br />
		<<"2 - Non-Fiction" <<endl<br />
		<<"3 - Reference" <<endl<br />
		<<"4 - pond"<< endl;<br />
	cout << "Enter the type: ";<br />
	cin >> i;<br />
	//books.typeofbook = i;<br />
<br />
	if(i == 1)<br />
	{<br />
		cout << "You chose Fiction\n";<br />
	}<br />
	if(i == 2)<br />
	{<br />
		cout << "You chose Non-Ficiton\n";<br />
	}<br />
	if(i == 3)<br />
	{<br />
		cout << "You chose Reference\n";<br />
	}<br />
	if(i == 4)<br />
	{<br />
		cout << "You chose Pond\n";<br />
	}	<br />
<br />
	outfile.open("LIBRARIANSHAVE347CATS.DAT",ios::app);<br />
<br />
	if(outfile)<br />
	{<br />
		outfile << books.dewey;<br />
		outfile << books.title << endl;<br />
		outfile << books.author << endl;<br />
		outfile << books.released << endl;<br />
		outfile << books.num_pages << endl;<br />
		outfile << i << endl <<endl;<br />
<br />
	}<br />
	else<br />
	{<br />
		cout << "An error occurred while opening the file. \n";<br />
	}<br />
	outfile.close();<br />
	return 0;<br />
}

AnswerRe: final loop Pin
Hans Dietrich21-May-07 3:13
mentorHans Dietrich21-May-07 3:13 
AnswerRe: final loop Pin
David Crow21-May-07 3:15
David Crow21-May-07 3:15 
AnswerRe: final loop Pin
Stephen Hewitt21-May-07 14:46
Stephen Hewitt21-May-07 14:46 
QuestionRe: final loop Pin
Nelek21-May-07 19:55
protectorNelek21-May-07 19:55 
AnswerRe: final loop Pin
Stephen Hewitt22-May-07 14:16
Stephen Hewitt22-May-07 14:16 
GeneralRe: final loop Pin
Nelek23-May-07 21:09
protectorNelek23-May-07 21:09 
QuestionAPI to find IP Address of current Computer Pin
Mushtaque Nizamani21-May-07 2:55
Mushtaque Nizamani21-May-07 2:55 
QuestionRe: API to find IP Address of current Computer Pin
David Crow21-May-07 3:01
David Crow21-May-07 3:01 
AnswerRe: API to find IP Address of current Computer Pin
Hamid_RT22-May-07 2:26
Hamid_RT22-May-07 2:26 
GeneralSome Win32 Programming Tips and Tricks Pin
Virtual Coder21-May-07 2:54
Virtual Coder21-May-07 2:54 
QuestionHow to unregister a addin from MS Word? Pin
Banks K21-May-07 2:40
Banks K21-May-07 2:40 
QuestionRe: How to unregister a addin from MS Word? Pin
David Crow21-May-07 2:48
David Crow21-May-07 2:48 
AnswerRe: How to unregister a addin from MS Word? Pin
Banks K21-May-07 2:56
Banks K21-May-07 2:56 
QuestionRe: How to unregister a addin from MS Word? Pin
David Crow21-May-07 3:00
David Crow21-May-07 3:00 
GeneralRe: How to unregister a addin from MS Word? Pin
Tim Paaschen21-May-07 3:04
Tim Paaschen21-May-07 3:04 
QuestionMenu with images Pin
Alex Cutovoi21-May-07 2:36
Alex Cutovoi21-May-07 2:36 
AnswerRe: Menu with images Pin
Hans Dietrich21-May-07 3:17
mentorHans Dietrich21-May-07 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.