This works, if you don't know why just ask:
Code:
#include<iostream>
using namespace std;//otherwise need to use std::cout
class student
{
private:
char name[100];
char address[100];
char city[100];
char state[2];
char zip[5];
public:
student(){};
student( char name,char address,char city,char state,char zip);
void getdata()
{
cout<<"Enter name:"; cin>>name;
cout<<"Enter address:"; cin>>address;
cout<<"Enter city:"; cin>>city;
cout<<"Enter state:"; cin>>state;
cout<<"Enter zip:"; cin>>zip; //you had a typo
}
void showdata()
{
cout<<"NAME IS:"<<name<<endl;
cout<<"ADDRESS IS:"<<address<<endl;
cout<<"CITY IS:" <<city<<endl;
cout<<"STATE IS :"<<state<<endl;
cout<<"ZIP IS :"<<zip<<endl;
}
};
int main()
{
student Student; //you need to declare an instance and then use that
Student.getdata();
Student.showdata();
return 0;
}