| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm getting the following errors:
final.cpp C:\Documents and Settings\Boone's Logon\final.cpp(25) : error C2143: syntax error : missing ';' before '.' C:\Documents and Settings\Boone's Logon\final.cpp(25) : error C2143: syntax error : missing ';' before '.' C:\Documents and Settings\Boone's Logon\final.cpp(48) : error C2143: syntax error : missing ';' before '.' C:\Documents and Settings\Boone's Logon\final.cpp(48) : error C2143: syntax error : missing ';' before '.' Error executing cl.exe. when running the following program: // Name: Boone Webb // Program: final.cpp // Notes: #include <ctime> #include <iomanip> #include <iostream> #include <string> using namespace std; class ColorGame { public: void ctimer(int wait); void setColor(); }; void main() { srand(time(0)); cout << "The Color Match Game" << endl << endl; cout << "Memorize these 5 colors" << endl; ColorGame.ctimer(3); system("pause"); } void ColorGame::setColor() { string strCol[10]; strCol[0] = "BLACK"; strCol[1] = "GREEN"; strCol[2] = "BLUE"; strCol[3] = "CYAN"; strCol[4] = "MAGENTA"; strCol[5] = "YELLOW"; strCol[6] = "BROWN"; strCol[7] = "WHITE"; string strNew[5]; int x; int y; for (x = 0; x < 5; x++) { y = rand() % 8; strNew[x] = strCol[y]; cout << setw(20) << strNew[x] << endl; ColorGame.ctimer(3); system("cls"); } } void ColorGame::ctimer(int wait) { clock_t start, end; start = clock()/CLOCKS_PER_SEC; do { end = clock()/CLOCKS_PER_SEC; } while ((end - start) < wait); } Does anyone have any idea what I'm doing wrong? Any help is greatly appreciated. |
|
#2
|
|||
|
|||
|
Does anyone have any input? Sorry if I may seem impatient it's just that this final is coming down to the line of when it's due and it's driving me crazy that I can't figure out where the error is coming from.
|
|
#3
|
|||
|
|||
|
Im 90% sure it's the
; at the end of the while loop (If I remember correctly with C++ you finish the program with "END." ??) hope it solves the problem! |
|
#4
|
|||
|
|||
|
Hi,
We were facing similar problem. May be you are using the variable names which are getting defined in standard header files as something else. For example: We used a variable "s_addr" in a structure and we were including WINSOCK.H In WINSOCK.H their is a structure like the one mentioned below struct in_addr { union { struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b; struct { u_short s_w1,s_w2; } S_un_w; u_long S_addr; } S_un; #define s_addr S_un.S_addr /* can be used for most tcp & ip code */ #define s_host S_un.S_un_b.s_b2 /* host on imp */ #define s_net S_un.S_un_b.s_b1 /* network */ #define s_imp S_un.S_un_w.s_w2 /* imp */ #define s_impno S_un.S_un_b.s_b4 /* imp # */ #define s_lh S_un.S_un_b.s_b3 /* logical host */ }; Arun Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > missing ';' before '.' |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|