Click here to Skip to main content
15,902,777 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CString Question. Pin
Christian Graus9-Mar-04 15:24
protectorChristian Graus9-Mar-04 15:24 
GeneralRe: CString Question. Pin
modeonetwo9-Mar-04 15:30
modeonetwo9-Mar-04 15:30 
GeneralRe: CString Question. Pin
Robert A. T. Káldy9-Mar-04 23:19
Robert A. T. Káldy9-Mar-04 23:19 
GeneralNoob wants organization Pin
Slaru9-Mar-04 14:39
Slaru9-Mar-04 14:39 
GeneralRe: Noob wants organization Pin
Prakash Nadar9-Mar-04 16:39
Prakash Nadar9-Mar-04 16:39 
GeneralRe: Noob wants organization Pin
Curi0us_George9-Mar-04 17:15
Curi0us_George9-Mar-04 17:15 
GeneralRe: Noob wants organization Pin
Slaru20-Mar-04 13:32
Slaru20-Mar-04 13:32 
GeneralFile I/O Problem Pin
scrname9-Mar-04 13:44
scrname9-Mar-04 13:44 
i just started learning c++ so it may just be a noob question but i am haveing a problem. I am trying to make a prog that writes names and number to notepad. When i run it it write the names and number but on top of it it has a set of numbers (1245068) and that will happen everytime.

Example:
1245068
John
Doe
5678906
Jaine
Doe
23456789

That is what is on notepad. My question is what i am doing wrong to get that set of number and how to just write the first name then last name then number. If anyone could help it would be appreciated. my code is bellow.

#include<stdlib.h>
#include<iostream.h>
#include<fstream.h>



int main(int argc, char* argv[])
{

int x=0, y=0;
string L_Name[100];
string F_Name[100];
int number[100];
char resp;

//Reads if there is already info in there and puts it into array
ifstream read("File.txt");
while(!read.eof())
{
read >>F_Name[x] >>L_Name[x] >>number[x];
x++;
}
read.close();
//Where the user can enter more name
do
{
cout <<"First Name: ";
cin >>F_Name[x];
cout <<"Last Name: ";
cin >>L_Name[x];
cout <<"Number: ";
cin >>number[x];
x++;
cout <<"Would you like to enter another name?(y/n)";
cin >>resp;
}
while((resp=='y')||(resp=='Y'));
y=x;

//writes the origianl names then the new name but here is where i get the
//set of numbers
ofstream write("File.txt");
for(x=0; x<y; x++)
{
write <<F_Name[x] <<endl;
write <<L_Name[x] <<endl;
write <<number[x] <<endl;
}


return 0;
}

GeneralRe: File I/O Problem Pin
modeonetwo9-Mar-04 15:10
modeonetwo9-Mar-04 15:10 
GeneralRe: File I/O Problem Pin
Christian Graus9-Mar-04 15:12
protectorChristian Graus9-Mar-04 15:12 
GeneralRe: File I/O Problem Pin
scrname9-Mar-04 17:10
scrname9-Mar-04 17:10 
GeneralRe: File I/O Problem Pin
Christian Graus9-Mar-04 17:15
protectorChristian Graus9-Mar-04 17:15 
GeneralSetPercision in MFC Pin
MeterMan9-Mar-04 12:16
MeterMan9-Mar-04 12:16 
GeneralRe: SetPercision in MFC Pin
Ryan Binns9-Mar-04 17:52
Ryan Binns9-Mar-04 17:52 
GeneralRe: SetPercision in MFC Pin
MeterMan10-Mar-04 10:42
MeterMan10-Mar-04 10:42 
GeneralOnFIleOpen Current Directory Pin
Coremn9-Mar-04 12:11
Coremn9-Mar-04 12:11 
GeneralProblem with parsing a BYTE* Pin
__Cerb9-Mar-04 12:07
__Cerb9-Mar-04 12:07 
GeneralRe: Problem with parsing a BYTE* Pin
Curi0us_George9-Mar-04 12:35
Curi0us_George9-Mar-04 12:35 
GeneralRe: Problem with parsing a BYTE* Pin
__Cerb9-Mar-04 13:00
__Cerb9-Mar-04 13:00 
GeneralRe: Problem with parsing a BYTE* Pin
Curi0us_George9-Mar-04 17:03
Curi0us_George9-Mar-04 17:03 
QuestionAnyone has some experience with Windows 98 Enabled and Hebrew??? Pin
LukeV9-Mar-04 10:31
LukeV9-Mar-04 10:31 
QuestionCan Anyone Help me Plz Pin
MrNiceBerG9-Mar-04 10:16
MrNiceBerG9-Mar-04 10:16 
AnswerRe: Can Anyone Help me Plz Pin
MeterMan9-Mar-04 12:23
MeterMan9-Mar-04 12:23 
QuestionInteractive 2d graph control? Pin
khan20009-Mar-04 9:54
khan20009-Mar-04 9:54 
GeneralMSHTML debug help needed Pin
Arun Bhalla9-Mar-04 9:48
Arun Bhalla9-Mar-04 9:48 

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.