







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








Write a program that will input the record of 5 students in a file named “Personal_Info.txt”. The information inserted in the file is: Name, Gender, Age, Address and Cell Phone.
cin >> quiz3[i]; if (quiz1[i] + quiz2[i] + quiz3[i] <= 100 && quiz1[i] + quiz2[i] + quiz3[i] > 80) { grade = 'A'; } else if (quiz1[i] + quiz2[i] + quiz3[i] <= 80 && quiz1[i] + quiz2[i] + quiz3[i] > 60) { grade = 'B'; } else { grade = 'F'; } f << n[i] << " " << ad[i] << " " << quiz1[i] << " " << quiz2[i] << " " << quiz3[i] << " " << quiz1[i] + quiz2[i] + quiz3[i]<<" " << grade << endl; } f.close(); return 0; }
Write a program that read the record of the students stored in a data file in the program in
**Create a text file named as “num.txt” in any text editor. Write three numbers in each line as shown below. 66 33 16 13 29 12
Write a program that reads three numbers from each line, calculate the sum and store the result in a file “sum.txt” as shown below. (use tellp() and seekp() functions to get pointer position) 66 33 16 115 13 29 12 054 -- -- -- ----**
Write a program that reads three numbers from the file specified by the user, sums the numbers, and writes the sum to another file specified by the user.
cout << "The Largest number is :" << l << endl; cout << endl << endl; if (i < j && i < k && i < l) cout << "The Smallest number is : " << i << endl; if (j < i && j < k && j < l) cout << "The Smallest number is : " << j << endl; if (k < i && k < j && k < l) cout << "The Smallest number is : " << k << endl; if (l < i && l < j && l < k) cout << "The Smallest number is : " << l << endl; } writer.close(); reader.close(); }
Write a program that takes input both from an input file and from the keyboard. The input file contains the text of an official letter, except that the name of the recipient is indicated by the three characters #N#. The program asks the user for a name and then writes the letter to a second file but with the three letters #N# replaced by the name. The three-letter string #N# will occur exactly once in the letter.
b1.open("T81.txt"); a1 >> s >> a >> b >> c >> d >> e; b1.seekp(ios::end); b1 << endl; sum = a + b + c + d + e; b1 << "Total Sum is " << sum << endl; if (sum <= 100 && sum > 80) { b1 << "grade is A" << endl; } if (sum <= 80 && sum > 50) { b1 << "grade is B" << endl; } if (sum <= 50 && sum > 33) { b1 << "grade is C" << endl; } if(sum<=33) b1 << "grade is F"<<endl; }