Click here to Skip to main content
15,917,645 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralInteract with Windows Mediaplayer Pin
Chen Pang9-Mar-04 15:47
Chen Pang9-Mar-04 15:47 
GeneralStatic example compilation problem Pin
rmnowick9-Mar-04 15:47
rmnowick9-Mar-04 15:47 
Generalhelp with a simple program that use structure Pin
bishead9-Mar-04 15:44
bishead9-Mar-04 15:44 
GeneralRe: help with a simple program that use structure Pin
Christian Graus9-Mar-04 17:17
protectorChristian Graus9-Mar-04 17:17 
GeneralRe: help with a simple program that use structure Pin
Prakash Nadar9-Mar-04 17:28
Prakash Nadar9-Mar-04 17:28 
GeneralRe: help with a simple program that use structure Pin
Roger Wright9-Mar-04 19:03
professionalRoger Wright9-Mar-04 19:03 
GeneralRe: help with a simple program that use structure Pin
Prakash Nadar9-Mar-04 19:07
Prakash Nadar9-Mar-04 19:07 
GeneralRe: help with a simple program that use structure Pin
Roger Wright9-Mar-04 19:26
professionalRoger Wright9-Mar-04 19:26 
GeneralRe: help with a simple program that use structure Pin
Prakash Nadar10-Mar-04 5:25
Prakash Nadar10-Mar-04 5:25 
QuestionHow to get system time to micro second? Pin
freehawk9-Mar-04 15:15
freehawk9-Mar-04 15:15 
AnswerRe: How to get system time to micro second? Pin
Anonymous9-Mar-04 15:18
Anonymous9-Mar-04 15:18 
GeneralRe: How to get system time to micro second? Pin
freehawk9-Mar-04 16:40
freehawk9-Mar-04 16:40 
GeneralCString Question. Pin
modeonetwo9-Mar-04 15:05
modeonetwo9-Mar-04 15:05 
GeneralRe: CString Question. Pin
Christian Graus9-Mar-04 15:15
protectorChristian Graus9-Mar-04 15:15 
GeneralRe: CString Question. Pin
modeonetwo9-Mar-04 15:20
modeonetwo9-Mar-04 15:20 
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 

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.