मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता ११

Debug the error in the following program. #include<istream.h> structPersonRec { charlastName[10]; chaefirstName[10]; int age; } PersonRecPeopleArrayType[10]; void main() { PersonRecord people - Computer Science

Advertisements
Advertisements

प्रश्न

Debug the error in the following program.

#include <istream.h>
structPersonRec
{
    charlastName[10];
    chaefirstName[10];
int age;
}
PersonRecPeopleArrayType[10]; 
void main()
{
    PersonRecord people; 
    for (i = 0; i < 10; i++)
{
    cout<<people.firstName<< ‘ ‘ <<people.lastName <<people.age;
}
for (int i = 0; i < 10; i++)
{
    cout<< "Enter first name: "; cin<<peop[i].firstName;
    cout<< "Enter last name: "; cin>>peop[i].lastName;
    cout<< "Enter age: "; cin>> people[i].age;}
}
थोडक्यात उत्तर

उत्तर

Corrected Program:

#include<istream.h>
#include<iomanip>
using namespace std;
struct PersonRee
{
char lastName[10];
char firstName[10]; int age;
}
PersonRecPeople[10];
VoidLoadArray();
int main()
{
Load Array();
for(i = 0; i<=10, i++)
{
cout<<people[i]. firstname;
cout<<people[i]. lastname;
cout<<setw(10)<<people[i].age<<endl;
}
}
VoidLoadArray()
{
for (int i = 0; i<10; i++)
{
cout<<"Enter first name:";
cin>>people[i].firstName;
cout<<"Enter last name:";
cin>>people[i].lastName;
cout<<"Enter age";
cin>>people[i].age;
}
}
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 12: Arrays and Structures - Evaluation - Section - D [पृष्ठ २२६]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 11 TN Board
पाठ 12 Arrays and Structures
Evaluation - Section - D | Q 5. | पृष्ठ २२६
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×