Click here to Skip to main content
15,896,154 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Windows SDK Communication Question Pin
Jethro6319-Feb-07 7:53
Jethro6319-Feb-07 7:53 
QuestionComBSTR Question Pin
Like2Byte19-Feb-07 3:41
Like2Byte19-Feb-07 3:41 
AnswerRe: ComBSTR Question Pin
prasad_som19-Feb-07 6:00
prasad_som19-Feb-07 6:00 
GeneralRe: ComBSTR Question Pin
Like2Byte19-Feb-07 7:21
Like2Byte19-Feb-07 7:21 
AnswerRe: ComBSTR Question Pin
Stephen Hewitt19-Feb-07 17:40
Stephen Hewitt19-Feb-07 17:40 
GeneralRe: ComBSTR Question Pin
Like2Byte20-Feb-07 3:51
Like2Byte20-Feb-07 3:51 
QuestionCLISTBOX Owner Drawn ListBox , DrawText does not return correct height. Pin
Killer319-Feb-07 3:35
Killer319-Feb-07 3:35 
Questionfile input program Pin
klutez12319-Feb-07 3:19
klutez12319-Feb-07 3:19 
I'm trying to make a program to open a file named stats.dat and input name, batting average, and home run amount. So far I have:

#include "stdafx.h"<br />
#include "statistics.h"       <br />
                            <br />
#include <fstream><br />
#include <iostream><br />
#include <string><br />
<br />
// Global Declarations<br />
using namespace std;<br />
CWinApp TheApp;<br />
<br />
/*****************************************************<br />
*                        MAIN                        *<br />
*****************************************************/<br />
<br />
int main()<br />
{<br />
	//variable declarations<br />
	char end, lc;           //declare char<br />
	int hr_num;         //declare int<br />
	float bat_avg;      //declare float<br />
	string name;        //declare string<br />
	ofstream outfile;   //declare an ofstream filestream<br />
<br />
	outfile.open("FLOATS.DAT",ios::app);   //open file for output<br />
<br />
	lc = 'y';<br />
<br />
	if(outfile)   //if file opened successfully<br />
	{   <br />
		while (lc = 'y')                                                   //<br />
		{<br />
			cout << "Enter the name of the player: ";<br />
			getline(cin, name);<br />
			outfile << name<<endl;<br />
			cout << "Enter the batting average of the player: ";<br />
			cin >> bat_avg;<br />
			outfile << bat_avg<<endl;<br />
			cout << "Enter the player's home runs: ";<br />
			cin >> hr_num;<br />
			outfile << hr_num<<endl;<br />
			cin.ignore(80, '\n');<br />
			cout << "Would you like to enter information for another player? Enter 'y' or 'n': ";<br />
			cin >> lc;<br />
		}                                      //while x does not equal 0<br />
	}<br />
	else   //if file failed to open...<br />
	{<br />
		cout << "Error opening file.\n";   //output error message<br />
	}<br />
	outfile.close();   //close file<br />
	<br />
	return 0;   //terminate program  <br />
}<br />
<br />


My problem is that after the .exe runs through once and will skip lines the second time through. All help is appreciated
AnswerRe: file input program Pin
David Crow19-Feb-07 3:22
David Crow19-Feb-07 3:22 
AnswerRe: file input program Pin
toxcct19-Feb-07 3:23
toxcct19-Feb-07 3:23 
GeneralRe: file input program Pin
jhwurmbach19-Feb-07 3:32
jhwurmbach19-Feb-07 3:32 
GeneralRe: file input program Pin
Sebastian Schneider19-Feb-07 3:59
Sebastian Schneider19-Feb-07 3:59 
Questiondrawing pixels in a different game Pin
Parallan19-Feb-07 2:34
Parallan19-Feb-07 2:34 
AnswerRe: drawing pixels in a different game [modified] Pin
Newbie0019-Feb-07 4:11
Newbie0019-Feb-07 4:11 
GeneralRe: drawing pixels in a different game Pin
Parallan19-Feb-07 4:33
Parallan19-Feb-07 4:33 
GeneralRe: drawing pixels in a different game [modified] Pin
Parallan19-Feb-07 4:52
Parallan19-Feb-07 4:52 
QuestionRe: drawing pixels in a different game Pin
Mark Salsbery19-Feb-07 8:07
Mark Salsbery19-Feb-07 8:07 
QuestionRe: drawing pixels in a different game [modified] Pin
Parallan19-Feb-07 8:25
Parallan19-Feb-07 8:25 
QuestionSystem Menu Pin
urid19-Feb-07 2:02
urid19-Feb-07 2:02 
QuestionRe: System Menu Pin
David Crow19-Feb-07 3:08
David Crow19-Feb-07 3:08 
AnswerRe: System Menu Pin
urid19-Feb-07 3:21
urid19-Feb-07 3:21 
GeneralRe: System Menu Pin
jhwurmbach19-Feb-07 3:36
jhwurmbach19-Feb-07 3:36 
GeneralRe: System Menu Pin
Hamid_RT19-Feb-07 5:00
Hamid_RT19-Feb-07 5:00 
QuestionListBox control Pin
Kiethnt19-Feb-07 0:48
Kiethnt19-Feb-07 0:48 
QuestionRe: ListBox control Pin
Nibu babu thomas19-Feb-07 0:51
Nibu babu thomas19-Feb-07 0:51 

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.