Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
ASSIGN C++.docx

ASSIGN C++.docx

Ratings: (0)|Views: 5 |Likes:
Published by Balram Jha

More info:

Published by: Balram Jha on Nov 07, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

11/07/2012

pdf

text

original

 
Q1.
Write a program to create a structure student and declare data members such as: stu_id,stu_name, stu_address,stu_section, contact_no,total_marks and member functions toa. Input data for N studentsb. Display data for N students.c. Search students who has more than 80 marks.d. Sort students according to name.Use functions, nested structures where required.
1.solu:
#include<iostream.h>#include<conio.h>struct student{int stu_id,contact_no,total_marks;char stu_name[10],stu_address[10],stu_section[5];}s[20];void display(struct student);main(){cout<<"enter the information of students like:stu_id, stu_name, stu_address,stu_section,contact_no,total_marks";int l,i,j;cout<<"enter the number of students to have data:";cin>>l;for(i=0;i<l;i++){cin>>s[i].stu_id;gets(s[i].stu_name);gets(s[i].stu_address);gets(s[i].stu_section);
 
cin>>s[i].contact_no;cin>>s[i].total_marks;cin.ignore();}for(j=0;j<l;j++){display(s[j]);}for(i=0;i<l;i++){if(s[i].total_marks>80){display(s[i]);}}char dataval[5][10];for(i=0;i<l;i++){for(int j=0;j<7;j++){dataval[i][j]=s[i].stu_name[j];} }cout<<endl;
 
cout<<"here are the sorted list of names"<<endl;for(k=97;k<123;k++){for(i=0;i<l;i++){if(dataval[i][0]==k){for(int j=0;j<7;j++){cout<<dataval[i][j];}cout<<endl;}}}getch();}void display(struct student s1){cout<<s1.stu_id<<s1.stu_name<<s1.stu_address<<s1.stu_section<<s1.contact_no<<s1.total_marks;}

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->