Thanks Daved! I will try to remeber what you said.
Actually I truied to make sense of this by doing a program and I would like you guys to let me know if this is a correct way of doinf it. I'll admit that I'm getting 1 error I don't really understand what it means. If any of you can help I'd really appriciate this.
Code:
#include <iostream>
#include <string.h>
#include <stdlib.h>
using std::cout;
using std::cin;
using std::endl;
using namespace std;
struct StudentRecord{
char Name[20];
int ID;
float GPA;
} ClassStudent;
void printrecord (StudentRecord ClassStudent);
int main()
{
ClassStudent.Name = "SuperProgrammer ";
ClassStudent.ID = 1234;
ClassStudent.GPA = 4.0;
printrecord (ClassStudent);
cout << "Enter Name: ";
cin.getline(ClassStudent.Name,20);
cout << "Enter ID: ";
cin.getline(ClassStudent.ID)
cout << "Enter GPA: ";
cin.getline(ClassStudent.GPA)
printrecord(ClassStudent);
return 0;
}
void printrecord (StudentRecord ClassStudent)
{
cout << “The Student’s Name is: “<<ClassStudent.Name<<“ ID:” <<ClassStudent.ID<< ClassStudent.GPA<<“ GPA:”<<endl;
}
Here is the error code I get:
Code:
test01.cpp(23) : error C2440: '=' : cannot convert from 'const char [20]' to 'char [20]'
Thanks for your help.