Original Post
Ok so I am little stuck.. I have a input file.. Marks.txt -------------- Bob 59.5 Jack 53.2 Sam 89.5 Joe 66.4 Ram 73.4 -------------- I have to create a program that reads this file and prints the top grade and the name associated with it. I can't figure out how to create a array that can hold the names of people.. My code is still in the testing stage but any help with the String storing will be appreciated. Thank you!
#include <iostream>
#include <fstream>
#include <string>
using namespace std; //introduces namespace std
int main ( void )
{
double mark[50];
char names[50];
String.namess[50];
ifstream inStream;
inStream.open("Marks.txt");
inStream >> names >> mark[0] >> mark[1] >> mark[2];
cout << "String is " << names <<endl;
cout << "Sum of " << mark[0] << " and " << mark[1] <<" is: "<< (mark[0]+mark[1]) <<endl;
cout << "Sum of " << mark[1] << " and " << mark[2] <<" is: "<< (mark[1]+mark[2]) <<endl;
return 0;
}