SHARE
TWEET

Untitled

a guest Dec 9th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. // Writing Data to File
  6.  
  7. int main(){
  8.     ofstream quiz;
  9.     int q1, q2, q3, total;
  10.     int kcstID;
  11.     quiz.open("grade.txt");
  12.     if (!quiz) {
  13.         cout << "File Creation failure!";
  14.     }
  15.     else    {
  16.         cout << "\n Enter your KCST ID ";
  17.         cin >> kcstID;
  18.         cout << "\n Enter Your CS-101 Quiz Marks(Max 10, 0 if absent)";
  19.         cout << "\n  Quiz 1 :";
  20.         cin >> q1;
  21.         cout << "\n  Quiz 2 :";
  22.         cin >> q2;
  23.         cout << "\n  Quiz 3 :";
  24.         cin >> q3;
  25.         total = q1 + q2 + q3;
  26.             // Writing Data to File
  27.         quiz << "\n KCST, Doha Kuwait" << endl << "------------------------------";         quiz << "\n KCST ID :" << kcstID<< endl << "-----------------------------";
  28.         quiz << "\n Quiz 1:" << q1 << "\t Quiz 2:" << q2 << "\tQuiz 3:" << q3<<"\n\t Total :"<<total;
  29.         quiz << endl << "----------------------------------------------";
  30.         cout << "\n Data Successfully stored";
  31.     }
  32.     quiz.close();
  33.     return 0;
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top