Here is all of my code. i some what got it to work now. the output is at the bottom.
Code:
#include "stdafx.h"
#include "iostream.h"
#include "string.h"
#include "stdlib.h"
#include "fstream.h"
void title();
class student {
public:
int getID();
char getNAME();
char getSS();
char getADDRESS();
char getCOURSES();
char getTERM();
char getMAJOR();
char getGRADE();
char getADVISOR();
void showID();
void showNAME();
void showSS();
void showADDRESS();
void showCOURSES();
void showTERM();
void showMAJOR();
void showGRADE();
void showADVISOR();
private:
long id;
int zip;
char fname[20], mname[20], lname[20], ss[15], street[80], town[20], state[2];
char courses[10], pname[20], days[5], stime[5], etime[5], term[15], major[80];
char grade[2], advisor[20];
};
int main()
{
student newSTUDENT;
system("color 0A");
title();
newSTUDENT.getID();
newSTUDENT.getNAME();
newSTUDENT.getSS();
newSTUDENT.getADDRESS();
newSTUDENT.getCOURSES();
newSTUDENT.getTERM();
newSTUDENT.getMAJOR();
newSTUDENT.getGRADE();
newSTUDENT.getADVISOR();
system("cls");
title();
newSTUDENT.showID();
newSTUDENT.showNAME();
newSTUDENT.showSS();
newSTUDENT.showADDRESS();
newSTUDENT.showCOURSES();
newSTUDENT.showTERM();
newSTUDENT.showMAJOR();
newSTUDENT.showGRADE();
newSTUDENT.showADVISOR();
return 0;
}
void title() {
cout<<"*******************************************************************************"<<endl<<endl<<endl;
cout<<" Welcome To My First Database Program! "<<endl<<endl;
cout<<"*******************************************************************************"<<endl<<endl;
}
int student::getID() {
cout<<"STUDENT ID: ";
cin>>id;
cin.ignore(7, '\n');
return 0;
}
char student::getNAME() {
cout<<endl<<"FIRST NAME: ";
cin>>fname;
cout<<endl<<"MIDDLE NAME: ";
cin>>mname;
cout<<endl<<"LAST NAME: ";
cin>>lname;
strupr(fname);
strupr(mname);
strupr(lname);
return 0;
}
char student::getSS() {
cout<<endl<<"SOCIAL SECURITY: ";
cin>>ss;
cin.ignore(15, '\n');
return 0;
}
char student::getADDRESS() {
cout<<endl<<"STREET ADDRESS: ";
cin.getline(street, 80, '\n');
cin.ignore(80, '\n');
cout<<endl<<"TOWN: ";
cin>>town;
cout<<endl<<"STATE: ";
cin>>state;
cout<<endl<<"ZIP CODE: ";
cin>>zip;
cin.ignore(7, '\n');
strupr(street);
strupr(town);
strupr(state);
return 0;
}
char student::getCOURSES() {
cout<<endl<<"COURSES: ";
cin.getline(courses, 10, '\n');
strupr(courses);
return 0;
}
char student::getTERM() {
cout<<endl<<"TERM: ";
cin.getline(term, 15, '\n');
cin.ignore(15, '\n');
strupr(term);
return 0;
}
char student::getMAJOR() {
cout<<endl<<"MAJOR: ";
cin.getline(major, 80, '\n');
strupr(major);
return 0;
}
char student::getGRADE() {
cout<<endl<<"CLASS: ";
cin>>grade;
strupr(grade);
return 0;
}
char student::getADVISOR() {
cout<<endl<<"ADVISOR: ";
cin.getline(advisor, 20, '\n');
cin.ignore(20, '\n');
strupr(advisor);
return 0;
}
void student::showID() {
cout<<endl<<"ID: "<<id<<endl;
}
void student::showNAME() {
cout<<endl<<"NAME: "<<fname<<" "<<mname<<" "<<lname<<endl;
}
void student::showSS() {
cout<<endl<<"SOCIAL SECURITY: "<<ss<<endl;
}
void student::showADDRESS() {
cout<<endl<<"ADDRESS: "<<endl<<street<<endl<<town<<", "<<state<<" "<<zip<<endl;
}
void student::showCOURSES() {
cout<<endl<<"COURSES:"<<endl<<courses<<endl;
}
void student::showTERM() {
cout<<endl<<"TERM: "<<term<<endl;
}
void student::showMAJOR() {
cout<<endl<<"MAJOR: "<<major<<endl;
}
void student::showGRADE() {
cout<<endl<<"CLASS: "<<grade<<endl;
}
void student::showADVISOR() {
cout<<endl<<"ADVISOR: "<<advisor<<endl;
}
I know its kinda long but i am just being bored tonight ...ok now here is the out put after it clears the screen:
************************************************** ***************************
Welcome To My First Database Program!
************************************************** ***************************
ID: 136499
NAME: WANTED STUFF ALLDAY
SOCIAL SECURITY: 466716873
ADDRESS:
1234 MAIN STREET
AUSTIN, TXCPTR 234 78602
COURSES:
CPTR 234
TERM: SPRING 2004
MAJOR: COMPUTER SCIENCE
CLASS: FR
ADVISOR:
Press any key to continue
My problems are:
i have to hit enter twice for the street address and for term
if you look after the "AUSTIN, TX" it has the course for somereason
last but not least the ADVISOR: doesnt show what i entered