Thursday, March 17, 2011

roster test

#include <fstream>
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
  double gradePoint;
  ofstream fout;
  while(true)
  {
    cout << "What is your grade [0-4.0]? ";
    cin >> gradePoint;
    cin.ignore(1000,10);
                                
// fill the code to separate out
// students' grade point are above 3.0
// AND
// students' grade point are below 2.0



    cout << "your grade point is " << gradePoint << endl;
    fout.open("roster2.txt", ios::app);
    if(!fout.good()) throw "I/O Error";
    fout << gradePoint << endl;
    fout.close();
  } // while
  return 0;
}

No comments:

Post a Comment