-2
即時通訊工具遇到任務問題,我需要製作游泳池課程,並要求用戶輸入游泳池信息,以便它可以給您填充游泳池所需的時間游泳池的數量取決於水量。第一個問題是與pool1.setsize(),pool1.setfillrate(),setarea,setlevel我得到錯誤LNK2019他們也有一些語法錯誤,我無法弄清楚如何擺脫,一個是在.gettime ()說參數太少,但我不是試圖通過一個說法我嘗試讓送回編譯時出現游泳池類錯誤
#include "stdafx.h"
#include <iostream>
using namespace std;
class swimmingpool
{
public:
void setsize(int, int, int);
void setarea(int);
void setfillrate(int);
void setdrainrate(int);
int gettime(int&);
void setlevel(int);
level = level * length * width;
level = area - level;
Time = level/fillrate;
private:
int length;
int width;
int depth;
int area;
int fillrate;
int drainrate;
int Time;
int level;
};
int _tmain()
{
swimmingpool pool1;
int len;
int wid;
int dep;
int are;
int fill;
int drn;
int lvl;
int time;
cout << "enter length, width, depth" << endl;
cin >> len;
cin >> wid;
cin >> dep;
cout << endl;
pool1.setsize(len, wid, dep);
are = len * wid * dep;
pool1.setarea(are);
cout << "enter the fill rate (int only for a sqft per hr)" << endl;
cin >> fill;
cout << endl;
pool1.setfillrate(fill);
cout << "enter water level" << endl;
cin >> lvl;
cout << endl;
pool1.setlevel(lvl);
time = pool1.gettime();
//lvl = lvl * len * wid;
//lvl = are - lvl;
//time = lvl/fill;
cout << " it will take " << time << " hours" " to fill " << lvl << " sqft in the pool" << endl;
system("pause");
return 0;
謝謝,但對於不能編譯的部分,我可以把它放在gettime中嗎? – stev0104 2014-09-23 03:47:34
你當然可以。 – Anton 2014-09-23 04:05:20