0 like 0 dislike
650 views

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++
ID: 24390 - Available when: Unlimited - Due to: Unlimited

reshown by | 650 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.
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.126.3
©2016-2025

Related questions

0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Jun 1, 2017 in C++
ID: 24855 - Available when: Unlimited - Due to: Unlimited
| 2k views
0 like 0 dislike
15 answers
[Exercise] Coding (C) - asked Jun 1, 2017 in C++
ID: 24854 - Available when: Unlimited - Due to: Unlimited
| 2k views
0 like 0 dislike
87 answers
[Exercise] Coding (C) - asked Mar 2, 2017 in C
ID: 22313 - Available when: Unlimited - Due to: Unlimited
| 6.4k views
12,783 questions
183,442 answers
172,219 comments
4,824 users