Q-1: Create a structure to specify data on students given
below:
Roll number, Name, Department, Course, Year of joining
Assume that there are not more than 450 students in the
college.

Answer Posted / ahmed

#include <iostream>

using namespace std;
struct student
{
int roll_num;
int year;
char name[10];
char dept[10];
char course[10];

};

int main()
{
student s[5];
int i,j;

for(i=0;i<5;i++)
{
cout<<"Enter roll number student "<<i+1<<" : ";
cin>>s[i].roll_num;
cout<<"Enter Your name student "<<i+1<<" : ";
cin.ignore();
cin.getline(s[i].name,10);
cout<<"Enter your department student "<<i+1<<" : ";
cin.ignore();
cin.getline(s[i].dept,10);
cout<<"Enter your course student "<<i+1<<" : ";
cin.ignore();
cin.getline(s[i].course,10);
cout<<"Enter year of joining : ";
cin>>s[i].year;
}

for(j=0;j<5;j++)
{
cout<<"Student "<<j+1<<" Details : "<<endl;
cout<<" Roll no. : "<<s[j].roll_num<<endl;
cout<<" Name : "<<s[j].name<<endl;
cout<<" Department : "<<s[j].dept<<endl;
cout<<" Course : "<<s[j].course<<endl;
cout<<" year : "<<s[j].year;
cout<<endl;
cout<<endl;
}

return 0;
}

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between constant pointer and constant variable?

742


What are the parts of c program?

627


How many keywords are there in c?

586


What is putchar() function?

628


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

974






How can you avoid including a header more than once?

555


What is #define?

569


Where static variables are stored in memory in c?

519


What is calloc malloc realloc in c?

586


What is an lvalue?

627


What is 2 d array in c?

545


What is the difference between text and binary i/o?

586


Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80

2549


What is ambagious result in C? explain with an example.

2049


What is unsigned int in c?

551