Hello,
I am currently working on a program that is supposed to do the following:
I am supposed to take a data file of 5 student names that are in the following form: lastName firstName middleName. I am supposed to convert each name to the following form: firstName middleName lastName. The program must read each students entire name in a variable and must consist of a function that takes as input a string, consist of a students name, and returns the string consisting of the altered name. Use the string function FIND to find the index of ,; the function LENGTH to find the length of the string: and the function SUBSTR to extract the firstName, middleName, and lastName.
Here is my data file being used:
Miller, Jason Brian
Blair, Lisa Maria
Gupta, Anil Kumar
Arora, Sumit Sahil
Saleh, Rhonda Beth
Here is my program so far. I am not sure if I am on the right track or not.
#include <iostream>
#include <string>
#include <fstream>
#include <cassert>
#include <cfloat>
using namespace std;
int main()
{
ifstream fin;
fin.open(inputstudent.data());
assert ( fin.is_open());
int count=0;
double rading
sum=0.0;
for(;;)
{
fin >> reading;
if (fin.eof())break;
count++;
}
fin.close();
string outputname;
getline (cin, outputname);
ofstream fout (outputname.data());
assert(fout.is_open());
fout.close();
void reverseName (char inName[], char outName[])
{
char firstname[40];
char lastname [40];char last[40];
char first [40];
strcpy(firstname, last);
strcpy(lastname, first);
strcpy(firstname, lastname);
strcat(lastname, last);
strcat(firstname, first);
}