Click here to Skip to main content
15,893,381 members
Home / Discussions / C#
   

C#

 
GeneralRe: Lots of free tutorials on C sharp Pin
Christian Graus14-Mar-04 14:58
protectorChristian Graus14-Mar-04 14:58 
Generalfuntion look-ahead Pin
sleeping child9-Mar-04 16:53
sleeping child9-Mar-04 16:53 
GeneralRe: funtion look-ahead Pin
LongRange.Shooter10-Mar-04 4:36
LongRange.Shooter10-Mar-04 4:36 
GeneralLocalization Pin
The Bug9-Mar-04 14:18
The Bug9-Mar-04 14:18 
GeneralRe: Localization Pin
The Bug9-Mar-04 17:15
The Bug9-Mar-04 17:15 
GeneralRe: Localization Pin
Mazdak10-Mar-04 3:17
Mazdak10-Mar-04 3:17 
GeneralRe: Localization Pin
Heath Stewart10-Mar-04 6:09
protectorHeath Stewart10-Mar-04 6:09 
GeneralFile I/O Problem Pin
scrname9-Mar-04 13:23
scrname9-Mar-04 13:23 
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
Heath Stewart9-Mar-04 13:28
protectorHeath Stewart9-Mar-04 13:28 
GeneralRe: File I/O Problem Pin
Steven Campbell9-Mar-04 14:58
Steven Campbell9-Mar-04 14:58 
General.NET Grid Controls Pin
Giles9-Mar-04 12:08
Giles9-Mar-04 12:08 
GeneralRe: .NET Grid Controls Pin
Anonymous9-Mar-04 12:17
Anonymous9-Mar-04 12:17 
GeneralRe: .NET Grid Controls Pin
John Fisher9-Mar-04 12:32
John Fisher9-Mar-04 12:32 
GeneralRe: .NET Grid Controls Pin
Heath Stewart9-Mar-04 13:27
protectorHeath Stewart9-Mar-04 13:27 
GeneralRe: .NET Grid Controls Pin
Holger Persch9-Mar-04 19:45
Holger Persch9-Mar-04 19:45 
GeneralPassing a xml document to and from a web service... Pin
Manster9-Mar-04 9:55
Manster9-Mar-04 9:55 
GeneralRe: Passing a xml document to and from a web service... Pin
Heath Stewart9-Mar-04 13:26
protectorHeath Stewart9-Mar-04 13:26 
QuestionCan I make this sloppy array better? Pin
MKlucher9-Mar-04 9:44
MKlucher9-Mar-04 9:44 
AnswerRe: Can I make this sloppy array better? Pin
Tom Larsen9-Mar-04 9:56
Tom Larsen9-Mar-04 9:56 
AnswerRe: Can I make this sloppy array better? Pin
LongRange.Shooter9-Mar-04 10:10
LongRange.Shooter9-Mar-04 10:10 
AnswerRe: Can I make this sloppy array better? Pin
MKlucher9-Mar-04 10:17
MKlucher9-Mar-04 10:17 
GeneralRe: Can I make this sloppy array better? Pin
LongRange.Shooter10-Mar-04 4:56
LongRange.Shooter10-Mar-04 4:56 
GeneralSecuitry restrictions with Runtime.remoting Pin
hammackj9-Mar-04 9:19
hammackj9-Mar-04 9:19 
GeneralRe: Secuitry restrictions with Runtime.remoting Pin
Tom Larsen9-Mar-04 10:04
Tom Larsen9-Mar-04 10:04 
GeneralRe: Secuitry restrictions with Runtime.remoting Pin
hammackj9-Mar-04 11:22
hammackj9-Mar-04 11:22 

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.