I am getting garbage values for this program.. Please help.
/*
===============
== Program 8 ==
===============
Q. Write a program to enter and print student's details (Personal, Academics
and Skills) using multiple inheritance
*/
#include <iostream.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
class skills
{
public:
char hobby[];
char skills[];
};
class academics
{
public:
float percent;
};
class student: public skills, public academics
{
public:
char NAME[];
char CLASS[];
int age;
char sex;
void input()
{
cout << "Enter the name: ";
gets(NAME);
cout << "Enter the class: ";
gets(CLASS);
cout << "Enter the age: ";
cin >> age;
cout << "Enter the sex (M/F): ";
cin >> sex;
cout << "Enter the overall percentage: ";
cin >> percent;
cout << "Enter the hobbies (each separated by a comma): ";
gets(hobby);
cout << "Enter the skills (each separated by a comma): ";
gets(skills);
}
void output()
{
cout << "Name: " << NAME << endl << "Class: " << CLASS << endl;
cout << "Age: " << age << endl << "Sex: " << sex << endl;
cout << "Percent: " << percent << endl << "Hobbies: " << hobby << endl;
cout << "Skills: " << skills;
}
};
void main()
{
student S;
S.input();
clrscr();
S.output();
int k;
cin >> k;
}