SlideShare una empresa de Scribd logo
1 de 2
Write a C++ program to compute numeric grades for a course. The course records are in a file
that will serve as the input file. The input file is in exactly the fol- lowing format: each line
contains a student’s last name, then one space, the the student’s first name, then one
space, then ten quiz scores all on one line The quiz scores are whole numbers and are separated
by one space. Your program will take its input from this file and send its output to a second file.
The data in the output file will be the same as the data in the input file except that there will be
one additional number (of type double) at the end of each line. This number will be the average
of the student’s ten quiz scores. If this is being done as a class assignment, obtain the file
names from your instructor. use at least one function that has file streams as all or some of its
arguments.
use the file "6_02_in" in the general section of Moodle. The file could include more data with
the same format. Use 6_02_out for output file name.
Solution
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(){
ifstream infile;
ofstream outfile;
string filename;
cout<<"Enter input filename";
cin>>filename;
infile.open(filename.c_str());
cout<<"Enter output filename";
cin>>filename;
outfile.open(filename.c_str());
string firstname,lastname;
int grade[10];
double average;
int count =0;
while(infile>>lastname){
outfile<<lastname<<" ";
infile>>firstname;
outfile<<firstname<<" ";
int sum =0;
for(int i=0;i<10;i++){
infile>>grade[i];
sum+=grade[i];
outfile<<grade[i]<<" ";
}
average = sum/10.0;
outfile<<average<<endl;
}
return 0;
}

Más contenido relacionado

Similar a Write a C++ program to compute numeric grades for a course- The course.docx

Bt0065, c programming and data structures
Bt0065, c programming and data structuresBt0065, c programming and data structures
Bt0065, c programming and data structuressmumbahelp
 
Hello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdfHello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdfactioncbe1
 
VIT351 Software Development VI Unit5
VIT351 Software Development VI Unit5VIT351 Software Development VI Unit5
VIT351 Software Development VI Unit5YOGESH SINGH
 
Deletion of a Record from a File - K Karun
Deletion of a Record from a File - K KarunDeletion of a Record from a File - K Karun
Deletion of a Record from a File - K KarunDipayan Sarkar
 
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and FuncCSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and FuncMargenePurnell14
 
File handling.pptx
File handling.pptxFile handling.pptx
File handling.pptxVishuSaini22
 
INput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxINput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxAssadLeo1
 
Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make YASHU40
 
CSC388 Online Programming Languages Homework 3 (due b.docx
CSC388 Online Programming Languages  Homework 3 (due b.docxCSC388 Online Programming Languages  Homework 3 (due b.docx
CSC388 Online Programming Languages Homework 3 (due b.docxannettsparrow
 
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdfReaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdffashionbigchennai
 

Similar a Write a C++ program to compute numeric grades for a course- The course.docx (14)

Bt0065, c programming and data structures
Bt0065, c programming and data structuresBt0065, c programming and data structures
Bt0065, c programming and data structures
 
Hello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdfHello guys please make sure program runs well USING C anyth.pdf
Hello guys please make sure program runs well USING C anyth.pdf
 
VIT351 Software Development VI Unit5
VIT351 Software Development VI Unit5VIT351 Software Development VI Unit5
VIT351 Software Development VI Unit5
 
Deletion of a Record from a File - K Karun
Deletion of a Record from a File - K KarunDeletion of a Record from a File - K Karun
Deletion of a Record from a File - K Karun
 
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and FuncCSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
 
File handling.pptx
File handling.pptxFile handling.pptx
File handling.pptx
 
Functions in python
Functions in pythonFunctions in python
Functions in python
 
7 Data File Handling
7 Data File Handling7 Data File Handling
7 Data File Handling
 
INput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptxINput output stream in ccP Full Detail.pptx
INput output stream in ccP Full Detail.pptx
 
Project report
Project reportProject report
Project report
 
Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make
 
CSC388 Online Programming Languages Homework 3 (due b.docx
CSC388 Online Programming Languages  Homework 3 (due b.docxCSC388 Online Programming Languages  Homework 3 (due b.docx
CSC388 Online Programming Languages Homework 3 (due b.docx
 
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdfReaction StatisticsBackgroundWhen collecting experimental data f.pdf
Reaction StatisticsBackgroundWhen collecting experimental data f.pdf
 
Python Lecture 9
Python Lecture 9Python Lecture 9
Python Lecture 9
 

Más de lez31palka

ctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docxctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docxlez31palka
 
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docxCSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docxlez31palka
 
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docxCritical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docxlez31palka
 
Critical Reflection 2 is a reflective essay that connects a personal e.docx
Critical Reflection 2 is a reflective essay that connects a personal e.docxCritical Reflection 2 is a reflective essay that connects a personal e.docx
Critical Reflection 2 is a reflective essay that connects a personal e.docxlez31palka
 
Credit rating agencies help investor to determine- A- If stock worth t.docx
Credit rating agencies help investor to determine- A- If stock worth t.docxCredit rating agencies help investor to determine- A- If stock worth t.docx
Credit rating agencies help investor to determine- A- If stock worth t.docxlez31palka
 
Create software that can encrypt and decrypt using a general substitut.docx
Create software that can encrypt and decrypt using a general substitut.docxCreate software that can encrypt and decrypt using a general substitut.docx
Create software that can encrypt and decrypt using a general substitut.docxlez31palka
 
create a training to give to others on a skillset you are an expert on.docx
create a training to give to others on a skillset you are an expert on.docxcreate a training to give to others on a skillset you are an expert on.docx
create a training to give to others on a skillset you are an expert on.docxlez31palka
 
Create a tic tac toe game using Swift and taking input text input- You.docx
Create a tic tac toe game using Swift and taking input text input- You.docxCreate a tic tac toe game using Swift and taking input text input- You.docx
Create a tic tac toe game using Swift and taking input text input- You.docxlez31palka
 
Create a shell script file called q4-sh.docx
Create a shell script file called q4-sh.docxCreate a shell script file called q4-sh.docx
Create a shell script file called q4-sh.docxlez31palka
 
Create a python zork file based on the following UML- Use command func.docx
Create a python zork file based on the following UML- Use command func.docxCreate a python zork file based on the following UML- Use command func.docx
Create a python zork file based on the following UML- Use command func.docxlez31palka
 
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docx
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docxCreate a new python program- sniff_spoof_icmp-py- The program shall sn.docx
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docxlez31palka
 
Create a new webpage called -activity2-html-- This new page must inclu.docx
Create a new webpage called -activity2-html-- This new page must inclu.docxCreate a new webpage called -activity2-html-- This new page must inclu.docx
Create a new webpage called -activity2-html-- This new page must inclu.docxlez31palka
 
Create a multi-client-single server application to check whether the n.docx
Create a multi-client-single server application to check whether the n.docxCreate a multi-client-single server application to check whether the n.docx
Create a multi-client-single server application to check whether the n.docxlez31palka
 
Create a list containing decimal numbers- Write a program to find the.docx
Create a list containing decimal numbers- Write a program to find the.docxCreate a list containing decimal numbers- Write a program to find the.docx
Create a list containing decimal numbers- Write a program to find the.docxlez31palka
 
Create a JAVA class called Staff that has the following attributes- St.docx
Create a JAVA class called Staff that has the following attributes- St.docxCreate a JAVA class called Staff that has the following attributes- St.docx
Create a JAVA class called Staff that has the following attributes- St.docxlez31palka
 
Create a Java class with the below attributes- Create a class called.docx
Create a Java class with the below attributes-  Create a class called.docxCreate a Java class with the below attributes-  Create a class called.docx
Create a Java class with the below attributes- Create a class called.docxlez31palka
 
Create a JAVA class called Faculty that has the following attributes-.docx
Create a JAVA class called Faculty that has the following attributes-.docxCreate a JAVA class called Faculty that has the following attributes-.docx
Create a JAVA class called Faculty that has the following attributes-.docxlez31palka
 
Create a garden project - Submit a project scope document - Submit R.docx
Create a garden project   - Submit a project scope document - Submit R.docxCreate a garden project   - Submit a project scope document - Submit R.docx
Create a garden project - Submit a project scope document - Submit R.docxlez31palka
 
Create a file named insert-php and add the new records in to your rese.docx
Create a file named insert-php and add the new records in to your rese.docxCreate a file named insert-php and add the new records in to your rese.docx
Create a file named insert-php and add the new records in to your rese.docxlez31palka
 
Corporate Fund started the year with o net asset value of $30-80- By y.docx
Corporate Fund started the year with o net asset value of $30-80- By y.docxCorporate Fund started the year with o net asset value of $30-80- By y.docx
Corporate Fund started the year with o net asset value of $30-80- By y.docxlez31palka
 

Más de lez31palka (20)

ctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docxctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
ctivity-Based Product Costing 2oberts Company produces two weed eaters.docx
 
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docxCSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
CSC 3020 Introduction to Cybersecurity Lab Assignment 2 CAE-CD Knowled.docx
 
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docxCritical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
Critical Thinking Questions- 18 (page 761) The U-S- government has shu.docx
 
Critical Reflection 2 is a reflective essay that connects a personal e.docx
Critical Reflection 2 is a reflective essay that connects a personal e.docxCritical Reflection 2 is a reflective essay that connects a personal e.docx
Critical Reflection 2 is a reflective essay that connects a personal e.docx
 
Credit rating agencies help investor to determine- A- If stock worth t.docx
Credit rating agencies help investor to determine- A- If stock worth t.docxCredit rating agencies help investor to determine- A- If stock worth t.docx
Credit rating agencies help investor to determine- A- If stock worth t.docx
 
Create software that can encrypt and decrypt using a general substitut.docx
Create software that can encrypt and decrypt using a general substitut.docxCreate software that can encrypt and decrypt using a general substitut.docx
Create software that can encrypt and decrypt using a general substitut.docx
 
create a training to give to others on a skillset you are an expert on.docx
create a training to give to others on a skillset you are an expert on.docxcreate a training to give to others on a skillset you are an expert on.docx
create a training to give to others on a skillset you are an expert on.docx
 
Create a tic tac toe game using Swift and taking input text input- You.docx
Create a tic tac toe game using Swift and taking input text input- You.docxCreate a tic tac toe game using Swift and taking input text input- You.docx
Create a tic tac toe game using Swift and taking input text input- You.docx
 
Create a shell script file called q4-sh.docx
Create a shell script file called q4-sh.docxCreate a shell script file called q4-sh.docx
Create a shell script file called q4-sh.docx
 
Create a python zork file based on the following UML- Use command func.docx
Create a python zork file based on the following UML- Use command func.docxCreate a python zork file based on the following UML- Use command func.docx
Create a python zork file based on the following UML- Use command func.docx
 
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docx
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docxCreate a new python program- sniff_spoof_icmp-py- The program shall sn.docx
Create a new python program- sniff_spoof_icmp-py- The program shall sn.docx
 
Create a new webpage called -activity2-html-- This new page must inclu.docx
Create a new webpage called -activity2-html-- This new page must inclu.docxCreate a new webpage called -activity2-html-- This new page must inclu.docx
Create a new webpage called -activity2-html-- This new page must inclu.docx
 
Create a multi-client-single server application to check whether the n.docx
Create a multi-client-single server application to check whether the n.docxCreate a multi-client-single server application to check whether the n.docx
Create a multi-client-single server application to check whether the n.docx
 
Create a list containing decimal numbers- Write a program to find the.docx
Create a list containing decimal numbers- Write a program to find the.docxCreate a list containing decimal numbers- Write a program to find the.docx
Create a list containing decimal numbers- Write a program to find the.docx
 
Create a JAVA class called Staff that has the following attributes- St.docx
Create a JAVA class called Staff that has the following attributes- St.docxCreate a JAVA class called Staff that has the following attributes- St.docx
Create a JAVA class called Staff that has the following attributes- St.docx
 
Create a Java class with the below attributes- Create a class called.docx
Create a Java class with the below attributes-  Create a class called.docxCreate a Java class with the below attributes-  Create a class called.docx
Create a Java class with the below attributes- Create a class called.docx
 
Create a JAVA class called Faculty that has the following attributes-.docx
Create a JAVA class called Faculty that has the following attributes-.docxCreate a JAVA class called Faculty that has the following attributes-.docx
Create a JAVA class called Faculty that has the following attributes-.docx
 
Create a garden project - Submit a project scope document - Submit R.docx
Create a garden project   - Submit a project scope document - Submit R.docxCreate a garden project   - Submit a project scope document - Submit R.docx
Create a garden project - Submit a project scope document - Submit R.docx
 
Create a file named insert-php and add the new records in to your rese.docx
Create a file named insert-php and add the new records in to your rese.docxCreate a file named insert-php and add the new records in to your rese.docx
Create a file named insert-php and add the new records in to your rese.docx
 
Corporate Fund started the year with o net asset value of $30-80- By y.docx
Corporate Fund started the year with o net asset value of $30-80- By y.docxCorporate Fund started the year with o net asset value of $30-80- By y.docx
Corporate Fund started the year with o net asset value of $30-80- By y.docx
 

Último

Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 

Último (20)

Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 

Write a C++ program to compute numeric grades for a course- The course.docx

  • 1. Write a C++ program to compute numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the fol- lowing format: each line contains a student’s last name, then one space, the the student’s first name, then one space, then ten quiz scores all on one line The quiz scores are whole numbers and are separated by one space. Your program will take its input from this file and send its output to a second file. The data in the output file will be the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student’s ten quiz scores. If this is being done as a class assignment, obtain the file names from your instructor. use at least one function that has file streams as all or some of its arguments. use the file "6_02_in" in the general section of Moodle. The file could include more data with the same format. Use 6_02_out for output file name. Solution #include <iostream> #include <fstream> #include <string> using namespace std; int main(){ ifstream infile; ofstream outfile; string filename; cout<<"Enter input filename"; cin>>filename; infile.open(filename.c_str()); cout<<"Enter output filename"; cin>>filename; outfile.open(filename.c_str()); string firstname,lastname; int grade[10]; double average; int count =0; while(infile>>lastname){
  • 2. outfile<<lastname<<" "; infile>>firstname; outfile<<firstname<<" "; int sum =0; for(int i=0;i<10;i++){ infile>>grade[i]; sum+=grade[i]; outfile<<grade[i]<<" "; } average = sum/10.0; outfile<<average<<endl; } return 0; }