I have to display this prrogram 3 different times using a FOR LOOP but he never showed us how it goes or where it goes I read it in my book and try many different things but nothing works its like it has to display three different people's name and everything using using the FOR LOOP. I am bugging out staying up all night tring to figure this out PLEASE HELP ME PLEASSSSSE!!
I did this program by myself adding the if statement and cin.get but he got me on the rest
// description: display student name, major, status, gpa, and tuition
#include <iostream.h>
#include <iomanip.h>
#include <string.h>
#include <stdlib.h>
void getdata();
void processdata();
void putdata();
char st_name[25];
char st_major[25],c;
char st_status[9];
float f_gpa;
int i_tuition1;
void main()
{
getdata();
processdata();
putdata();
}
void getdata()
{
cout << "\n\nPlease enter student name: ";
cin.getline(st_name,25);
cout << "\n\nPlease enter student gpa: ";
cin >> f_gpa;
cout << "\n\nPlease enter student major: ";
cin.getline(st_major,25);
int i=0;
while((c = cin.get()) != '\n')
{
st_major[i] = c;
i++;
}
st_major[i] = '\0';
cout << "\n\nPlease enter student status as"
<< " 'I' for instate or 'O' for outstate: ";
cin.getline(st_status,9);
cout << "\n\nPlease enter student tuition: ";
cin >> i_tuition1;
}
void processdata()
{
if(strcmp(st_status,"outstate")==0)
i_tuition1= i_tuition1 + 1500;
if(strcmp(st_status,"instate")==0)
i_tuition1= i_tuition1 + 0;
}
void putdata()
{
cout << "\n\nName: " << st_name;
cout << "\n\nMajor: " << st_major;
cout << setiosflags(ios::fixed)
<< setiosflags(ios::showpoint)
<< setprecision(2);
cout << "\n\nGPA: " << f_gpa;
cout << "\n\nStatus: " << st_status;
cout << "\n\nTuition: $ " << i_tuition1 << endl;
}
you all can email me @ simmons_hs@hotmail.com