trying to learn c++ and now im stuck

closed account (D9hk4iN6)
OKAY SO I AM TRYING TO LEARN C++ AND I HAVE COMPLETED FOUR OF THREE OF THE FOUR ASSIGNMENTS FOR THE UNIT. nOW I AM STUCK ON THE LAST ONE AND I NEED HELP FIGURING IT OUT:

HERE IS THE INSTRUCTIONS AND WHAT I HAVE DONE SO FAR. wHAT I HAVE DONE IS WRONG AND I KNOW IT. ONE MORE PROBLEM IS IT KEEP SAYING ILLEGAL IDENTIFIER EVEN THOUGH I ADDED THEM! PLEASE HELP - THANK YOU

Write a program that reads student information from a file (one student per line) in the format:
StudentFirstName StudentLastName StudentID StudentTest1 StudentTest2 StudentTest3
and outputs them in the following format:
StudentLastName, StudentFirstNameInitial StudentID StudentTest1 StudentTest2 StudentTest3
where StudentFirstNameInitial is the initial (first letter) of the first name of student. Let us assume that the name
(StudentLastName, StudentFirstNameInitial) can be at most 15 characters, the StudentID can be at most 7
characters, and the StudentTest scores need up to 7 characters. The StudentTest scores should be formatted to have
exactly 2 decimals and should be aligned to the right. The rest of the values should be aligned to the left. Make sure you
are not missing any of the digits of the student ID. File.txt is an example of input file that you can use to test your
program.

#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <fstream>
#include <string>



int _tmain(int argc, _TCHAR* argv[])
{
string Mary;
string John;
string Anna;

cin >> Mary;
cin >> John;
cin >> Anna;

cout << "\nstring= "<<Mary;
cout << "\nstring= "<<John;
cout << "\nstring= "<<Anna;


//open input file stream file.
ifstream in("file1.txt");
// file output with task performed.
ofstream out("file2.txt");

in >> Clark Mary 0000111 90 84.75 98.25
in >> Donaldson John 0002222 59.5 75 56.50
in >> Hernandez Anna 0333333 78.75 75.555 67.000

cout << "/nstring = " <<Mary
cout << "/nstring = " <<John
cout << "/nstring = " <<Anna
_getch();
return 0;
}


Topic archived. No new replies allowed.