Advertisement
Guest User

Van

a guest
Mar 3rd, 2019
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <cstring>
  5. using namespace std;
  6. int main()
  7. {
  8. string g;
  9. string e;
  10. char degree[30];
  11. char b[30];
  12. int a;
  13. string k;
  14. int c;
  15. int j;
  16. float y;
  17. float w;
  18. float m;
  19. int n;
  20. string d;
  21. string duser, dpass;
  22. string inputuser, inputpass;
  23. string data;
  24. char newdata[30];
  25. ifstream infile;
  26. infile.open("Security.txt");
  27. getline(infile,data);
  28. duser = data;
  29. getline(infile,data);
  30. dpass = data;
  31.  
  32. cout << "Student Information System \n";
  33. cout << "Login \n";
  34. cout << "Username: ";
  35. cin >> inputuser;
  36. cout << "\nPassword: ";
  37. cin >> inputpass;
  38. while (inputuser != duser || inputpass != dpass)
  39. {
  40. cout << "Incorrect! Please relogin \n";
  41. cout << "Username: \n";
  42. cin >> inputuser;
  43. cout << "\nPassword: ";
  44. cin >> inputpass;
  45. }
  46. if (inputuser == duser && inputpass == dpass)
  47. {
  48. system("pause");
  49. system("cls");
  50. cout << "Welcome to Student Information System! \n";
  51. }
  52. cout << "1. Student Information \n";
  53. cout << "2. Quit \n";
  54. cin >> j;
  55.  
  56. if (j == 1)
  57. {
  58. cout << " 1. Add \n";
  59. cout << " 2. Edit \n";
  60. cout << " 3. Read \n";
  61. cout << " 4. Delete Student Data \n";
  62. cout << " 5. Back to Main Menu \n";
  63. cin >> c;
  64. if (c==1)
  65. {
  66. cout << "Enter your ID Number: ";
  67. cin >> k;
  68. k+= ".txt";
  69. ofstream addfile;
  70. addfile.open(k.c_str());
  71. cout << "Input name: ";
  72. cin.getline(b,30);
  73. getline(cin,data);
  74. addfile << data << endl;
  75. cout <<"Enter your College Year: ";
  76. cin >> a;
  77. while( a < 0 || a > 4)
  78. {
  79. cout <<"Year level not recognized! Re Enter Grade level! ";
  80. cin >> a;
  81. }
  82.  
  83. addfile << a << endl;
  84. cin.ignore();
  85. cout << "Enter your Degree and Specialization: ";
  86. getline(cin,data);
  87. addfile << data << endl;
  88. cout <<"Enter your Section: ";
  89. getline(cin,data);
  90. addfile << data << endl;
  91. cout <<"Enter your Academic Year: ";
  92. getline(cin,data);
  93. addfile << data << endl;
  94. cout <<"Enter your Subject: ";
  95. getline(cin,data);
  96. addfile << data << endl;
  97.  
  98. cout <<"Enter your midterm grade: ";
  99. cin >> y;
  100. if (y<60)
  101. while (y<60 || y > 100)
  102. {
  103. cout <<"Invalid Grade! Please re enter Midterm Grade! ";
  104. cin >> y;
  105. }
  106. else if (y>100)
  107. while (y>100 || y < 60)
  108. {
  109. cout <<"Invalid Grade! Please re Midterm Grade! ";
  110. cin >> y;
  111. }
  112. addfile << y << endl;
  113. cout <<"Enter your final grade: ";
  114. cin >> w;
  115. if (w<60)
  116. while (w < 60 || w > 100)
  117. {
  118. cout <<"Invalid Grade! Please re enter Final Grade! ";
  119. cin >> w;
  120. }
  121. else if (w>100)
  122. while (w > 100 || w < 60)
  123. {
  124. cout <<" Invalid Grade! Please re enter Final Grade! ";
  125. cin >> w;
  126. }
  127.  
  128. addfile << w << endl;
  129. m =(y + w) / 2;
  130. cout <<"Here is your total grade: " << m;
  131. if (m<60)
  132. {
  133. cout <<" No Grade! Please re enter again! \n";
  134. }
  135. else if (m>100)
  136. {
  137. cout <<" No Grade! Please re enter again! \n";
  138. }
  139. addfile << m << endl;
  140. }
  141. else if (c==2)
  142. {
  143. cout << "Please input the ID Number you wish to edit ";
  144. cin >> d;
  145. d+=".txt";
  146. ifstream myfile;
  147. myfile.open(d.c_str());
  148. getline(myfile,data);
  149. cout << "Enter your new information: ";
  150. cout <<"Full name: " << data << endl;
  151. cout << "College Year: " << data << endl;
  152. getline(myfile,data);
  153. cout << "Degree & Specialization: " << data << endl;
  154. getline(myfile,data);
  155. cout << "Section: " << data << endl;
  156. getline(myfile,data);
  157. cout << "School Year: " << data << endl;
  158. getline(myfile,data);
  159. cout << "Subject: " << data << endl;
  160. getline(myfile,data);
  161. cout << "Midterm Grade: " << data << endl;
  162. getline(myfile,data);
  163. cout << "Final Grade: " << data << endl;
  164. getline(myfile,data);
  165. cout << "Total Grade: " << data << endl;
  166. getline(myfile,data);
  167. cout << data << endl;
  168. }
  169. else if (c==3)
  170. {
  171. cout << "Please input the ID Number you wish to read ";
  172. cin >> d;
  173. d+=".txt";
  174. ifstream myfile;
  175. myfile.open(d.c_str());
  176. getline(m
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement