2013-10-03 78 views
-5

我在嘗試運行此代碼時遇到此錯誤,不知道爲什麼。任何幫助是欣賞...我是新的。 71 42 [錯誤]功能太多的參數'void summary()' 這是一個C++類,我不知道我做錯了什麼。新學生......參數太多

/* 

Programmer name: Kris Rossman 
date:    9/24/2013 
assignment:   Lab 6 Part 1 

description:  Math Problem continued             

INPUTS: 
    cin - three different career types(string) 
OUTPUTS: 
    cout - The fortune teller's prediction 
*/ 

#include <iostream> 
#include <cstdlib> 
#include <string> 
#include <iomanip> 
#include <time.h> 
#define myDate  "October 1st, 2013    " 
#define myActivity "Lab 6 Part 2     " 
#define line1 " This program will ask for three different  " 
#define line2 " careers, then it will predict the job you are " 
#define line3 " most likely going to have.      " 
#define over2 "\t\t" 
#define over3 "\t\t\t" 
#define over4 "\t\t\t\t" 
#define down5 "\n\n\n\n\n" 
#define down8 "\n\n\n\n\n\n\n\n" 
#define down10 "\n\n\n\n\n\n\n\n\n\n" 
#define down12 "\n\n\n\n\n\n\n\n\n\n\n\n"             

using namespace std; 

void splash(); 
void welcome(); 
void summary(); 

int main(int argc, char *argv[]) 
{ 
    string career1, career2, career3; 
    int num1; 

    splash(); 
    welcome(); 

    system("CLS"); 

    unsigned seed = time(0); 
    srand(seed); 
    num1 = 1 +rand() % 4; 

    cout << down12; 
    cout << over3 << "Enter Career 1: "; 
    getline(cin, career1); 
    system("CLS"); 

    cout << down12; 
    cout << over3 << "Enter Career 2: "; 
    getline(cin, career2); 
    system("CLS"); 

    cout << down12; 
    cout << over3 << "Enter Career 3: "; 
    getline(cin, career3); 
    system("CLS"); 

    cout << down10; 

    if (num1 == 1) 
     summary(career1,career2,career3,career1); 
    else if (num1 == 2) 
     summary(career1,career2,career3,career2); 
    else if (num1 ==3) 
     summary(career1,career2,career3,career3); 
    else 
     summary(career1,career2,career3,"none of these jobs..."); 

    cout << down10; 
    return EXIT_SUCCESS; 

} 

void summary(string car1, string car2, string car2, string carA) 
{ 
    cout << down5; 
    cout << over3 << "The jobs you entered were:" << endl; 
    cout << over3 << "__________________________" << endl; 
    cout << over3 << "1. " << car1 << endl; 
    cout << over3 << "2. " << car2 << endl; 
    cout << over3 << "3. " << car3 << endl; 
    cout << over3 << "Your job will be " << carA <<endl;  
} 
+3

我相信你或別人剛剛發佈此完全相同[大約5分鐘前代碼](http://stackoverflow.com/questions/19168348/new-student-working-with-strings-and-functions) – smac89

+2

你是學生。你正在編寫所有那些可怕的'#define's。某個教授在某個地方正在驗證我的觀點,即教授們在教C++的時候很勉強。 –

+0

我的答案在下面有幫助嗎?如果是這樣,你可以點擊旁邊的複選標記來接受嗎?它有很多幫助。 – 0x499602D2

回答

10

你的函數的原型沒有任何參數:

void summary(); 

它應該是:

void summary(std::string, std::string, std::string, std::string); 
+0

在'void summary(string car1,string car2,string car2,string carA)'second'car2' should' car3' – P0W