Start New Discussion within our Software Development Community

Inside the infile.txt, I'm suppose to convert into outfile.txt. Unforunately, I'm unable to get the correct aglinment for outfile. As you can see, France and Vietnam have an extra "\t".

char ch;

switch (n)
{

    case 'F':   stud.type = n;
    infile >> stud.st.fs.country;
    infile.get(ch);
    infile.getline(stud.st.fs.name, MAX);
    break;

    case 'S':  stud.type = n;
    infile.get(ch);
    infile.getline(stud.st.ls.name, MAX);
    break;        
}

Let's say if i were to put another infile.get(ch); the first character of the foreigner will be remove except France and Vietnam as shown in the outfile2.txt

    char ch;

    switch (n)
    {

        case 'F':   stud.type = n;
        infile >> stud.st.fs.country;
        infile.get(ch);
        infile.get(ch);
        infile.getline(stud.st.fs.name, MAX);
        break;

        case 'S':  stud.type = n;
        infile.get(ch);
        infile.getline(stud.st.ls.name, MAX);
        break;        
    }

Can someone help me solve this problem?

Attachments
F	Indonesian	Michael Chen
F	France		Alain Pierre
S	Tan Eng Soon
S	Lee Ang Heng
F	Malaysia	Tan Eng Ming
F	Indonesian	Jospeh
F	Vietnam		Nguyen Min Thach
S	Nancy Chan
S	Heng Aik Koan
F	Japan	Yamada Suzuki
S	Wong Ah Beng
1    Indonesian          	Michael Chen       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
2    France              		Alain Pierre      0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
3    Singapore           	Tan Eng Soon       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
4    Singapore           	Lee Ang Heng       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
5    Malaysia            	Tan Eng Ming       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
6    Indonesian          	Jospeh             0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
7    Vietnam             		Nguyen Min Thach  0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
8    Singapore           	Nancy Chan         0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
9    Singapore           	Heng Aik Koan      0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
10   Japan               	Yamada Suzuki      0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
11   Singapore           	Wong Ah Beng       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
1    Indonesian          	ichael Chen       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
2    France              	Alain Pierre      0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
3    Singapore           	Tan Eng Soon       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
4    Singapore           	Lee Ang Heng       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
5    Malaysia            	an Eng Ming       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
6    Indonesian          	ospeh             0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
7    Vietnam             	Nguyen Min Thach  0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
8    Singapore           	Nancy Chan         0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
9    Singapore           	Heng Aik Koan      0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
10   Japan               	amada Suzuki      0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
11   Singapore           	Wong Ah Beng       0.0       0.0       0.0       0.0       0.0       0.0       0      Fail
This question has already been answered. Start a new discussion instead.