75) Write a program in C++ to input roll no and registration no of 10 student from an input file identity.txt. Input marks of three subject from another input file marks.txt of 10 student. Calculate total marks of all 10 student. Arrange and print roll no, registration no. and total marks in ascending order to output file named as ascend.txt. Rearrange and print roll no, registration no and total marks to another output file name as descend.txt?

#include<iostream.h> #include<conio.h> #include<fstream.h> void main() {                 int i,j,temp;                 int rn[10],reg[10],tm[10],s1,s2,s3;                 clrscr();                 ifstream identify("identify.txt");                 ifstream marks("marks.txt");                 ofstream ascend("ascend.txt");                 ofstream descend("descend.txt");                 for(i=0;i<10;i++)                                 {                                 identify>>rn[i]>>reg[i];                                 marks>>s1>>s2>>s3;                                 tm[i]=s1+s2+s3;                                 }                 for(i=0;i<9;i++)                                 for(j=i+1;j<10;j++)                                                 if(tm[j]<tm[i])                                                                 {                                                                 temp=tm[j]; tm[j]=tm[i]; tm[i]=temp;                                                                 temp=rn[j]; rn[j]=rn[i]; rn[i]=temp;                                                                ... Continue Reading →

Advertisements

74) Write a program in C++ to input roll no and marks of three subject of 10 student. Calculate total marks of all 10 student. Name of input file is marks.txt. Write roll no and total marks of only those students which total marks is greater than 300. Name of this output file is pass.txt. Write roll no and total marks of remaining student to another output file named as fail.txt?

#include<iostream.h> #include<fstream.h> #include<conio.h> void main() {                 int rn,s1,s2,s3,tm=0,i;                 clrscr();                 ifstream marks("marks.txt");                 ofstream pass("pass.txt");                 ofstream fail("fail.txt");                 for(i=0;i<10;i++)                                 {                                 marks>>rn>>s1>>s2>>s3;                                 tm=s1+s2+s3;                                 if(tm>=300)                                                 pass<<rn<<"\t"<<tm<<endl;                                 else                                                 fail<<rn<<"\t"<<tm<<endl;                                 }                 marks.close();                 pass.close();                 fail.close();                 getch(); }  

73) Write a program in C++ to input roll no and total marks from an input file of 10 student. Name of input file is marks.txt. write roll no and total marks of only those student two an output file which total marks is greater than equal to 300. Name of output file is result.txt?

#include<iostream.h> #include<conio.h> #include<fstream.h> void main() {                 int rn,tm,i;                 clrscr();                 ifstream marks("marks.txt");                 ofstream result("result.txt");                 for(i=0;i<10;i++)                                 {                                 marks>>rn>>tm;                                 if(tm>=300)                                                 result<<rn<<"\t"<<tm<<endl;                                 }                 marks.close();                 result.close();                 getch(); }  

71) Write a program in C++ to input roll no and marks of three subject of 10 student. Print roll no of only those student who secured 35 or more marks in every subject separately. Name of input file is marks.txt?

#include<iostream.h> #include<fstream.h> #include<conio.h> void main() {                 int rn,s1,s2,s3,i;                 clrscr();                 ifstream myfile;                 myfile.open("marks.txt");                 for(i=0;i<10;i++)                                 {                                 myfile>>rn;                                 myfile>>s1>>s2>>s3;                                 if(s1>=35 && s2>=35 && s3>=35)                                                 cout<<rn<<endl;                                 }                 myfile.close();                 getch(); }  

70) Write a program in C++ to input roll no and total marks of 10 student from an input data file marks.txt. Print roll no and total marks of only those student who get 300 or more in his total marks?

#include<iostream.h> #include<fstream.h> #include<conio.h> void main() {                 int rn,tm,i;                 clrscr();                 ifstream myfile("marks.txt");                 for(i=0;i<10;i++)                                 {                                 myfile>>rn;                                 myfile>>tm;                                 if(tm>=300)                                                 cout<<rn<<"\t"<<tm<<endl;                                 }                 myfile.close();                 getch(); }  

69) Write a program in C++ to input name and roll no of 5 student from an input data file student.txt. Print both name and roll no of all student on screen?

#include<iostream.h> #include<fstream.h> #include<conio.h> void main() {                 char name[20];                 int rn,i;                 clrscr();                 ifstream myfile;                 myfile.open("student.txt");                 for(i=0;i<5;i++)                                 {                                 myfile>>name;                                 myfile>>rn;                                 cout<<name<<"\t"<<rn<<endl;                                 }                 myfile.close();                 getch(); }  

68) Write a program in C++ to input roll no and total marks of some student until total marks and greater than zero. Arrange both roll no and total marks in descending order on total marks and write it to an output file name as result.txt?

#include<iostream.h> #include<fstream.h> #include<conio.h> void main() {                 int rn[50],tm[50],temp,i,j,n=0;                 clrscr();                 while(1)                                 {                                 cout<<"Enter Roll No :- ";                                 cin>>rn[n];                                 cout<<"Enter Total Marks :- ";                                 cin>>tm[n];                                 if(tm[n]==0)                                                 break;                                 n++;                                 }                 for(i=0;i<n-1;i++)                                 for(j=i+1;j<n;j++)                                                 {                                                 if(tm[j]>tm[i])                                                                 {                                                                 temp=tm[j];                                                                 tm[j]=tm[i];                                                                 tm[i]=temp;... Continue Reading →

67) Write a program in C++ to input roll no and total marks of some student from keyboard until total marks greater than zero. Write roll no and total marks of those student to one output file with total marks greater than or equal to 300. Name of this output file is pass.txt. Write roll no and total marks of remaining students in other output file named as fail.txt?

  #include<iostream.h> #include<fstream.h> #include<conio.h> void main() {                 int rn,tm=1;                 clrscr();                 ofstream pass("pass.txt");                 ofstream fail("fail.txt");                 while(tm>0)                 {                                 cout<<"Enter Roll No:- ";                                 cin>>rn;                                 cout<<"Enter Tatal Marks:- ";                                 cin>>tm;                                 if(tm>=300)                                                 pass<<rn<<"\t"<<tm<<endl;                                 else if(tm>0)                                                 fail<<rn<<"\t"<<tm<<endl;                 }                 pass.close();                 fail.close();                 getch(); }

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: