0 like 0 dislike

The program below can compare time which is generated by class CTime but it seems not working properly. Please help to fix it.

#include <iostream>
#include <cstdlib>
using namespace std;
class CTime
{
   private:
      int hour,min;
      double sec;

   public:

//Your code from here

 

//to here
};

int main(void)
{
   CTime t1(4,13,51.3);
   CTime t2(5,44,30.3);
   
   if(t1>t2)
      cout << "t1 is larger than t2" << endl;
   else
      cout << "t2 is larger than t1" << endl;

   if(t1<t2)
      cout << "t1 is smaller than t2" << endl;
   else
      cout << "t2 is smaller than t1" << endl;
   
   system("pause");
   return 0;
}

 

[Exercise] Coding (C) - asked in C++
Available when: Unlimited - Due to: Unlimited

reshown by | 87 views

1 Answer

0 like 0 dislike
Hidden content!
#include<iostream>
#include<string>
#include<fstream>
#include <iomanip>
using  namespace std;

 struct student{
   int score1;
   int score2;
   int score3;
   int score4;
   float avg;
   float gpa;
   string studentID;
};
float computeGPA(int n)
{
* ** *** * * * ** * * * ans;
* ** * ** * * ** * ** * * *** * *** **
* ** *** ** * **** ** * * * * * ***
* * * ** ** ** * ** ** * ** * * * ***
* * ** * ** *** ** *** * *** **** **** *** ** *
****** ** * * ** * * * *** * *** ***
*** **** * ****** * * ** * * * * * **** ** *
** * * *** * ** **** * * ** ** **** **** **
* ****** *** * * * * ** * * *** * *** *
* * ** ***** * ** * ** * * * ** ********* *
** * ** *** *** ** * *** * ** * * ***** ** * *
* * ** * * * * ** * ** *** *** ****** * ** *** * ** *
* ** * **** ****** * ** * * **** * ***** * * ***
**** * ** *** **** ** ** if(n<70&&n>66)
* ** * * * *** * ** * *** *********** * * * * ***
*** ***** * **** * *** * if(n<67&&n>62)
* * **** ******** * * * *** ** * * *** ***
* *** * * ** ** * **** if(n<63&&n>59)
** * ****** *** *** * * * *** ** ** ** ***
*** * * * * * * * if (n<60&&n>49)
* * *** ** ** * * * * ******* * ** * ** **
**** *** **** ***** * * ** *** *
* * * *** * * **** * * **** * * ** *** ** **

* ** * ** **** * ** * ans;
}

void bubblesort(student arr[],int n)
{
** * * **** ***** ** * * i=n-1;i>0;i--)
** * *** * * ** * * * ** ** *** *** * ** * j=0;j<i;j++)
** **** *** * * * *** ******** ** **** *** ***** * ** * * *** *
    {
* * * * * * ** **** **** * * *** * * * temp=arr[j+1];
* * * ****** **** ***** *** * * ** * * *
* * ** * * ** * ** ** * ***** * * * * * * * *
    }
}

int main()
{
string studentID;
int score1,score2,score3,score4;
int counter=0;
float gpa=0;
student gradeBook[10];
ifstream inputStream;
ofstream outputStream;
* ********* * ** **** **
***** * *** ** * * *

* *** ****** * * ****** * ** *  Course1 Course2 Course3 Course4 GPA"<< endl;
*** ***** ** **** * * * ** ** **** * **** *** ** * ***** ** ** * * * ** ** * * * ***
* * ** ** * * *** * ** * ** ** * ** * *** ** * * * ****
* * * *** * * ** ** ** ** * ** ** * **** ** ** * * ** * ***** ** * * *** ** * *** *** ** ******* *** * * * ** ** * *** **** ** * * *** * **** ** *** *** **** ** * * *** * ***** ** * * ** ** * * * * * ** * *** * * ** * ** **** * ** **** * *** * * * * * * ** * ** * *** * * ** * ** * ***** * * * * * **
* * * * * * * * ** ** * * ****
* *** * * * * *** **** ** ** * ** ** * ***
**** * * * * * *** ** ** ********
* * * ** * * * * * ** ** * ** **** ** **** * ** * * *
}
inputStream.close();
outputStream.close();

* * * * *** * *

***** ** ** * ** *** *** *

** * * ******* *** ********* ** ** *** * ** * * * ***** * ** * * * * ***
******* ** * * ****** * ** ** * *** ******* ** ** **** * * *
* * * * *** *** * ** ** * *** ***** * **
** * * * * * * ** * * * * * * ****
* *** ** * * * ***** *** * **
* *** ** *** ** * * * * * ** * * ******
*** ** ** ** ** *** * * **** * *
* * ** * **** * **** ****** * * * * *
* * * * * * *** * * *** * **
}
* * **** * * ****** ** * * *** ****

* ** ** * **** * * ** ** * * **** **

**** * * * ** ** * * *** ** *** * * * Course1 Course2 Course3 Course4 GPA"<< endl;
*** * * * * * ** * ** i=0;i<counter;i++){
* ** * ** * * * ** ** * * ** * * * * ** ** * * ** * ** * * ** ** * ** * ** * ** * * *** * ** *** **** * * * * ** *** * * *** ** * ** * ** * ***** ***** ** * **** * ** * * ** * * ** * *** * *** * *** ** * * ** ** ** * * * * * * ** * * * * * * ** ** **** ** ** * * *** *** * ** **** ** ** *** ***** * * * **** * * ** **
*** * * * * * * * * * **** ** * * * ** * ** *
*** ****** * ****** * * ** ** *
* **** ** *** **** ** ** * * *** *** *
* ** ** *** *** *** * * **** * * * ** ** *** *** * ***** ** *
    }
return 0;
}
answered by (-134 points)
edited by
0 0
prog.c:1:19: fatal error: iostream: No such file or directory
 #include<iostream>
                   ^
compilation terminated.
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.158.79.207
©2016-2020

Related questions

0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Jun 1, 2017 in C++
Available when: Unlimited - Due to: Unlimited
| 157 views
0 like 0 dislike
15 answers
[Exercise] Coding (C) - asked Jun 1, 2017 in C++
Available when: Unlimited - Due to: Unlimited
| 142 views
0 like 0 dislike
87 answers
[Exercise] Coding (C) - asked Mar 2, 2017 in C
Available when: Unlimited - Due to: Unlimited
| 402 views
10,551 questions
115,635 answers
103,526 comments
3,772 users