0 喜歡 0 不喜歡
920 瀏覽

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;
}

 

[練習] Coding (C) - 最新提問 分類:C++ |
ID: 24390 - 從幾時開始: 無限制 - 到幾時結束: 無限制

重新顯示 用戶: | 920 瀏覽

1個回答

0 喜歡 0 不喜歡
內容已隱藏
#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;
}
最新回答 用戶: (-134 分)
修改於 用戶:
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.69.17.59
©2016-2025

相關問題

0 喜歡 0 不喜歡
17 回答
[練習] Coding (C) - 最新提問 6月 1, 2017 分類:C++ |
ID: 24855 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 2.6k 瀏覽
0 喜歡 0 不喜歡
15 回答
[練習] Coding (C) - 最新提問 6月 1, 2017 分類:C++ |
ID: 24854 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 2.6k 瀏覽
0 喜歡 0 不喜歡
87 回答
[練習] Coding (C) - 最新提問 3月 2, 2017 分類:C |
ID: 22313 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 8.3k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶