C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 30th, 2004, 01:12 AM
dbufile dbufile is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 2 dbufile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation missing ';' before '.' (c++ help)

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.

Reply With Quote
  #2  
Old April 30th, 2004, 01:30 PM
dbufile dbufile is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 2 dbufile User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

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.

Reply With Quote
  #3  
Old May 4th, 2004, 01:46 PM
Pheeal Pheeal is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 7 Pheeal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 2 sec
Reputation Power: 0
Wink

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!

Reply With Quote
  #4  
Old February 3rd, 2005, 05:23 AM
Arun Kumar K Arun Kumar K is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 1 Arun Kumar K User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 40 sec
Reputation Power: 0
Smile missing ';' before '.'

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:
Originally Posted by dbufile
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > missing ';' before '.'


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT