Problemy z wywoływaniem funkcji.
Ostatnio zmodyfikowano 2015-07-06 10:10
Rikard Temat założony przez niniejszego użytkownika |
Problemy z wywoływaniem funkcji. » 2015-07-05 23:30:42 #include <cstdlib> #include <iostream> #include <conio.h> #include <string> #include <windows.h> using namespace std;
class Istota { public: int hp; int dmg; int mana; Istota(); Istota( int hp, int dmg, int mana ); int wyswietlMenu( int hp, int dmg, int mana ); };
Istota::Istota() { }
Istota::Istota( int hp, int dmg, int mana ) { this->hp = hp; this->dmg = dmg; this->mana = mana; } void profil( Istota gracz, int strImie ) { cout << "================+++++++++++++++++++++++++++++++======================"; cout << "Imie:" << strImie; } void gowno() { cout << "gowno"; }
int main( int argc, char * argv[] ) { int dupa; int gMap; int pMenu; Istota gracz( 100, 10, 0 ); Istota menu; string strImie; int nMenu; int wKlasa; cout << "\nAeria v00000.1 pre-alpha"; cout << "\n=================================================================="; cout << "\n1.Rozpocznij gre"; cout << "\n2.Wyjdz"; cout << "\n:"; cin >> nMenu; switch( nMenu ) { case 1: system( "cls" ); cout << "Podaj Imie:"; cin >> strImie; do { cout << "Wybierz Klase:\n1:Rycerz\n2.Mag"; cout << gracz.hp; cin >> wKlasa; switch( wKlasa ) { case 1: gracz.hp = gracz.hp + 50; gracz.dmg = gracz.dmg + 20; gracz.mana = gracz.mana + 10; system( "cls" ); break; case 2: gracz.hp = gracz.hp + 25; gracz.dmg = gracz.dmg + 10; gracz.mana = gracz.mana + 100; system( "cls" ); break; } } while( wKlasa > 2 ); break; case 2: exit( 0 ); break; } profil( Istota gracz, int strImie ); system( "PAUSE" ); }
Problem leży gdy chcę wywołać funkcję profil. Pojawia się komunikat 113 C:\Dev-Cpp\aeria.cpp expected primary-expression before "gracz". |
|
Rashmistrz |
» 2015-07-05 23:44:32 A numer lini? |
|
Admixior |
» 2015-07-06 02:19:45 Numer linii 113. Jeżeli chciałeś wywołać funkcje profil to powinieneś podać jej argumenty, ale bez typów, same nazwy. profil( gracz, strImie ); A po drugie to musisz zmienić definicję funkcji profil. Tak aby typ strImie się zgadzał (czyli int na string). |
|
Rikard Temat założony przez niniejszego użytkownika |
» 2015-07-06 10:10:36 Dzięki za pomoc! |
|
« 1 » |