Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- string g;
- string e;
- char degree[30];
- char b[30];
- int a;
- string k;
- int c;
- int j;
- float y;
- float w;
- float m;
- int n;
- string d;
- string duser, dpass;
- string inputuser, inputpass;
- string data,data2;
- ifstream infile;
- infile.open("Security.txt");
- getline(infile,data);
- duser = data;
- getline(infile,data);
- dpass = data;
- cout << "Student Information System \n";
- cout << "Login \n";
- cout << "Username: ";
- cin >> inputuser;
- cout << "\nPassword: ";
- cin >> inputpass;
- while (inputuser != duser || inputpass != dpass)
- {
- cout << "Incorrect! Please relogin \n";
- cout << "Username: \n";
- cin >> inputuser;
- cout << "\nPassword: ";
- cin >> inputpass;
- }
- if (inputuser == duser && inputpass == dpass)
- {
- system("pause");
- system("cls");
- cout << "Welcome to Student Information System! \n";
- }
- cout << "1. Student Information \n";
- cout << "2. Quit \n";
- cin >> j;
- if (j == 1)
- {
- cout << " 1. Add \n";
- cout << " 2. Edit \n";
- cout << " 3. Back to Main Menu \n";
- cin >> c;
- if (c==1)
- {
- cout << "Enter your ID Number: ";
- cin >> k;
- k+= ".txt";
- ofstream addfile;
- addfile.open(k.c_str());
- cout << "Input name: ";
- cin.getline(b,30);
- getline(cin,data);
- addfile << data << endl;
- cout <<"Enter your College Year: ";
- cin >> a;
- while( a < 0 || a > 4)
- {
- cout <<"Grade level not recognized! Re Enter Grade level! ";
- cin >> a;
- }
- addfile << a << endl;
- cin.ignore();
- cout << "Enter your Degree and Specialization: ";
- getline(cin,data);
- addfile << data << endl;
- cout <<"Enter your Section: ";
- getline(cin,data);
- addfile << data << endl;
- cout <<"Enter your Academic Year: ";
- getline(cin,data);
- addfile << data << endl;
- cout <<"Enter your Subject: ";
- getline(cin,data);
- addfile << data << endl;
- cout <<"Enter your midterm grade: ";
- cin >> y;
- while (y<60 || y > 100)
- if (y<60)
- {
- cout <<"Invalid Grade! Please re enter Midterm Grade! ";
- cin >> y;
- }
- else if (y>100)
- while (y>100 || y < 60)
- {
- cout <<"Invalid Grade! Please re Midterm Grade! ";
- cin >> y;
- }
- addfile << y << endl;
- cout <<"Enter your final grade: ";
- cin >> w;
- if (w<60)
- while (w < 60 || w > 100)
- {
- cout <<"Invalid Grade! Please re enter Final Grade! ";
- cin >> w;
- }
- else if (w>100)
- while (w > 100 || w < 60)
- {
- cout <<" Invalid Grade! Please re enter Final Grade! ";
- cin >> w;
- }
- addfile << w << endl;
- m =(y + w) / 3;
- cout <<"Here is your total grade: " << m;
- if (m<60)
- {
- cout <<" No Grade! Please re enter again! \n";
- }
- else if (m>100)
- {
- cout <<" No Grade! Please re enter again! \n";
- }
- addfile << m << endl;
- }
- else if (c==2)
- {
- cout << "Please input the ID Number you wish to read ";
- cin >> d;
- d+=".txt";
- ifstream myfile;
- myfile.open(d.c_str());
- getline(myfile,data);
- cout <<"Full name: " << data << endl;
- getline(myfile,data);
- cout << "College Year: " << data << endl;
- getline(myfile,data);
- cout << "Degree & Specialization: " << data << endl;
- getline(myfile,data);
- cout << "Section: " << data << endl;
- getline(myfile,data);
- cout << "School Year: " << data << endl;
- getline(myfile,data);
- cout << "Subject: " << data << endl;
- getline(myfile,data);
- cout << "Midterm Grade: " << data << endl;
- getline(myfile,data);
- cout << "Final Grade: " << data << endl;
- getline(myfile,data);
- cout << "Total Grade: " << data << endl;
- getline(myfile,data);
- cout << data << endl;
- }
- else if ( c==3 )
- {
- cout << "1. Student Information \n";
- cout << "2. Quit \n";
- cin >> j;
- }
- else if (j == 2)
- {
- cout << "Goodbye! ";
- return EXIT_SUCCESS;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement