program 1:
#include <iostream>
using namespace std;
class person
{
char name[30];
int age;
public:
void getdata(void);
void putdata(void);
};
void person :: getdata(void)
{
cout << "Enter name";
cin >> name;
cout << "Enter age";
cin >> age;
}
void person :: putdata(void)
{
cout << "\nName" << name;
cout << "\nage" << age;
}
int main()
{
person p;
p.getdata();
p.putdata();
return 0;
}
program 2:
#include<iostream.h>
using namespace std;
int main()
{
float i, j, sum, average;
cout << "Enter two numbers";
cin >> i >> j;
sum = i+j;
average = sum/2;
cout << "sum=" << sum;
cout << "average=" << average;
return (0);
}
I'm a student and I tried to execute the above programs. They would compile without a glitch but the execution is terminated without delivering the any result. Can anyone please help me out with this. I'll be grateful to you