User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » newbie needs help with C++ Page [1]  
atlrepresent
New Recruit
8 Posts
user info
edit post

Hello all. I'm having C++ issues. I'm pretty familiar with Java and I'm teaching myself C++ for a class. But I'm getting an error and I can't figure out how to fix it.

This is the error I'm getting:
Quote :
" 15 C:\Dev-Cpp\practice test 2.cpp expected constructor, destructor, or type conversion before '.' token
15 C:\Dev-Cpp\practice test 2.cpp expected `,' or `;' before '.' token"


I get the same error for several lines after as well.

Here is the code, the last line being line 15:
Quote :
"#include <iostream>

struct Student {
int id;
bool isGrad;
};

const int NS = 5;

Student stud[5];

Student s1;
//Student s2;

s1.isGrad= true;"


Am I not declaring/initializing something correctly? Any help you can give would be appreciated!

9/18/2006 11:30:00 PM

tjoshea
All American
4906 Posts
user info
edit post

maybe try declaring a main function and moving your =true assignment in there ?

9/19/2006 12:24:44 AM

SandSanta
All American
22435 Posts
user info
edit post

^

9/19/2006 1:00:53 AM

atlrepresent
New Recruit
8 Posts
user info
edit post

Sweet! Many thanks. I knew it was something simple like that.

9/19/2006 1:09:52 AM

Battousai
All American
1158 Posts
user info
edit post

ahh, the good 'ol days of highschool C++ classes at 7 o'clock in the morning.

9/19/2006 2:34:52 PM

rosschilen
All American
1025 Posts
user info
edit post

damn

9/19/2006 2:35:07 PM

MiniMe_877
All American
4414 Posts
user info
edit post

and FYI, you can use code tags to show your source code, not a quote box

cout << "Hello World!";


*HINT: hit edit post beside my post to see what I did, n00b

9/19/2006 2:57:29 PM

 Message Boards » Tech Talk » newbie needs help with C++ Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.