|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - function can't accept class type as paramater?!!
i really can't figure out why i can't this working, and it always errors out on
the parameter list of brceme
#include "stdlib.h"
#include "time.h"
#include "iostream.h"
#include "string.h"
#define std;
#define ITERS 5;
#define PLYRS 2;
#define CMBS 3; // rps.. or more?!
void brceme(string lala) { cout << lala << endl; }
int main () {
int i, i2;
srand ( time( NULL ) ); // init
for ( i2 = 0; i2 <= ITERS; i2++ ) {
cout << "game " << i2 << endl;
for ( i = 1; i <= PLYRS; i++ ) {
cout << i << " alalalal" << endl;
}
}
}
/*
this will out put:
C:\cpp>rps.cpp
void brceme(STRING lala) { cout << lala << endl; }
^
C:\cpp\rps.cpp(11) : Error: ')' expected to close function parameter list with
srand ( time( NULL ) ); // init
^
C:\cpp\rps.cpp(19) : Error: 'srand' is not in function parameter list
for ( i2 = 0; i2 <= ITERS; i2++ ) {
^
C:\cpp\rps.cpp(20) : Error: '=', ';' or ',' expected
for ( i = 1; i <= PLYRS; i++ ) {
^
C:\cpp\rps.cpp(22) : Error: '=', ';' or ',' expected
}
^
C:\cpp\rps.cpp(24) : Error: '=', ';' or ',' expected
Fatal error: too many errors
--- errorlevel 1
C:\cpp>
*/
i must be missing something simple!?!?
i've tried tons of variations on "string", lower-case/as a * pointer/
positioning of the pointer .. etc... and i see that obviously one can supply a
class type for a parameter... so i'm baffled.
rjm
Jun 29 2006
robertjaym gmail.com wrote:i really can't figure out why i can't this working, and it always errors out on the parameter list of brceme #include "stdlib.h" #include "time.h" #include "iostream.h" #include "string.h" Jun 30 2006
|