Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Structures, undeclared identifiers...and penguins!

BrpociBrpoci Member Posts: 11
I am currently learning Structures off of cprogramming.com's tutorial (http://www.cprogramming.com/tutorial/lesson7.html) and have run into a bit of a problem, the code is:#include
#include
using namespace std;

struct database
{
string lname;
int grade;
float credits;
};
int main()
{
database student;

student.lname=Conner;
student.grade=12;
student.credits=0.75;
cout<<student.lname <<endl <<student.grade <<endl <<student.credits<<endl;
return 0;
}

the problem is that it considers 'Conner' to be a 'identifier' and an undeclared one at that. I have tried everything i know, but the answer eludes me. could any of you give me a hand?

Thanks,
ThIS

Comments

  • RincewindRincewind Member Posts: 3
    [code]
    #include
    #include
    using namespace std;

    struct database
    {
    string lname;
    int grade;
    float credits;
    };
    int main()
    {
    database student;

    student.lname="Conner"; //the " " tells the compiler that Conner is a string
    student.grade=12;
    student.credits=0.75;
    cout<<student.lname <<endl <<student.grade <<endl <<student.credits<<endl;
    return 0;
    }
    [/code]

Sign In or Register to comment.