2012-03-29 9 views
-1

私はどのようにか理由がわからないし、Googleは本当に便利neighterませんでした,,,が、このエラーポップ用量とどのようにそれが固定されるかもしれません、なぜ誰もが言うことができますか?私は考えることができるすべてを試しました....私はアイデアがありません。ログをコンパイルすると、このエラーがどのようにポップアップする可能性がありますか?

エラー箇所:

**** Build of configuration Debug for project Lab3-5Mod **** 

**** Internal Builder is used for build    
**** g++ -ID:\c++\Begin\Lab3-5Mod -O0 -g3 -Wall -c -fmessage-length=0 -o src\UI.o..\src\UI.cpp 
..\src\UI.cpp: In function 'int printMenu()': 
..\src\UI.cpp:39:15: error: expected primary-expression before 'int' 
..\src\UI.cpp:39:24: error: expected primary-expression before 'int' 
..\src\UI.cpp:39:39: error: expected primary-expression before 'M' 
..\src\UI.cpp: In function 'int main()': 
..\src\UI.cpp:75:18: error: expected primary-expression before 'M' 
Build error occurred, build is stopped 
Time consumed: 370 ms. 

コード:

#include <iostream> 
#include "Structs.h" 
#include "structs.cpp" 
#include "controller.cpp" 
#include "UI.h" 

using namespace std; 

int printMenu(){ 

int input; 
input = 1; 
    while (input){ 
     cout<<"1. Add to current day "<<endl; 
     cout<<"2. Insert amount to day by type "<<endl; 
     cout<<"3. Remove day "<<endl; 
     cout<<"4. Remove days "<<endl; 
     cout<<"5. Remove type of expenses"<<endl; 
     cout<<"6. Replace type at specified day"<<endl; 
     cout<<"7. Show expenses bigger than"<<endl; 
     cout<<"8. Show expenses bigger than... to day..."<<endl; 
     cout<<"9. Show expenses of specified type overall"<<endl; 
     cout<<"10. Calculate sum of specified type over all"<<endl; 
     cout<<"11. Show day with highest expenses"<<endl; 
     cout<<"12. Show all days with specified expenses"<<endl; 
     cout<<"13. Sort days by expenses increasing"<<endl; 
     cout<<"14. Sort days by expenses discreasing"<<endl; 
     cout<<"15. Filter type"<<endl; 
     cout<<"16. Filter type starting with"<<endl; 
     cout<<"---------------------------------------------"<<endl; 
     cout<<"18. Undo"<<endl; 
     cout<<"0. Clear and exit!"<<endl; 

     cout<<"enter option: "; 
     cin>>input; 

     switch(input){ 
     case 1:add(int cant,int tip, Array M); 
     case 2: 
     case 3: 
     case 4: 
     case 5: 
     case 6: 
     case 7: 
     case 8: 
     case 9: 
     case 10: 
     case 11: 
     case 12: 
     case 13: 
     case 14: 
     case 15: 
     case 16: 
     case 17: 
     case 18: 
     case 19: 
     case 0:break; 
     default: cout<<"Wrong input!"<<endl;break; 

     } 
    } 

return 0; 
} 


int main() 
{ 
//Main function of the program. no pre/ post condition. 
Array M; 
constr(M); 
Array B; 
constr(B); 
dummyData(Array M); 

printMenu(); 
return 0; 
} 

アレイヘッダ:

struct Array{ 
    int days; 
    int exp; 
    int **M; 
}; 

void constr(Array &); 
void destruc(Array &); 
void add(int, int, Array &); 

コントローラ追加機能:

void add(int cant,int tip, Array M){ 
//Adds to current day the amount to a specific type 
    currDay(); 
    M.M[currentDay][tip] += cant; 
} 
+0

これは間違いなく十分な情報です。 'M'と' add() 'の宣言を追加してください。 –

+0

これらの構文エラーは、Cチュートリアルや書籍を読んでから、より多くのqを投稿するまでに時間を費やす必要があります。 –

+0

i'mは、ブックでの作業...しかし、私は多くの時間を持っていけない...と私は猛烈な勢いのために必要と私は何かをする方法を尋ねるが、私は多くのことを学ぶことによって、エラーを修正する方法いけません...私を覚えておく必要はありません。私はドンノC++ですが、あなたは正しいことを知っているときに尋ねたり応答したりするコミュニティです。 –

答えて

2

あなたはそのような機能を呼び出すことはありません。また、ここで

add(cant,tip, M); 

add(int cant,int tip, Array M); 

あなたはデータ型を指定する必要はありませんdummyData(Array M); - >dummyData(M);

あなただけのデータ型を指定します宣言はしますが、関数を呼び出すときは宣言しません。

+0

ありがとうございます:>私は今C++にまだギャップがあります。 :> –

1
case 1:add(int cant,int tip, Array M); 

addを呼び出すと、実際のパラメータの種類は指定されません。

関連する問題