1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
RSB [31]
3 years ago
9

C++ Code Outputs.

Computers and Technology
1 answer:
mojhsa [17]3 years ago
5 0

Answer:

#include

#include

#include

#include

using namespace std;

struct courseInfo{

string name;

int unit;

char grade;

};

struct Student {

string fName;

string lName;

string idNumber;

courseInfo courses[2];

int unitCompleted;

double gpa;

};

Student s;

bool openFile(ifstream &in);

void Print_info_one(Student s);

void Read_info(Student &s);

float Find_points(char c) ;

bool openFile(ifstream &inFile){

string line;

int i=0,k=0;

string fName="", lname="", id="", name1="", name2="";

char grade1, grade2;

int unit1, unit2;

if (inFile.is_open())

{

while (getline(inFile, line))

{

while (line[i] != ',')

{

fName += line[i];

i++;

}

i++;

i++;

while (line[i] != ' ')

{

lname += line[i];

i++;

}

i++;i++;

while (line[i] != ' ')

{

id += line[i];

i++;

}

i++;

int count=0;

while (count <2)

{

name1 += line[i];

i++;

if(line[i] == ' ' ) count++;

}

i++;

grade1 = line[i];

i++;i++;

unit1 = line[i]-'0';

i++;i++;

count=0;

while (count <2)

{

name2 += line[i];

i++;

if(line[i] == ' ' ) count++;

}

i++;

grade2 = line[i];

i++;i++;

unit2 = line[i]-'0';

}

inFile.close();

s.fName = fName;

s.lName = lname;

s.idNumber = id;

s.courses[0].name = name1;

s.courses[0].grade = grade1;

s.courses[0].unit = unit1;

s.courses[1].name = name2;

s.courses[1].grade = grade2;

s.courses[1].unit = unit2;

s.unitCompleted = unit1 + unit2;

s.gpa = (unit1*Find_points(grade1) + unit2*Find_points(grade2))/(unit1+unit2);

}

else

{

cout << "Error reading file\n";

return false;

}

return true;

}

void Print_info_one(Student s){

cout << "Name: " << s.fName << ", " << s.lName << " ID Number: " << s.idNumber << " Course 1 Name: " << s.courses[0].name << " Grade: "

<< s.courses[0].grade << " Units: " << s.courses[0].unit << " Course 2 Name: " << s.courses[1].name << " Grade: "

<< s.courses[1].grade << " Units: " << s.courses[1].unit << " Unit completed: " << s.unitCompleted << " GPA:" << s.gpa << endl;

}

void Read_info(Student &s){

}

float Find_points(char grade){

switch (grade)

{

case 'A':

return 4.0;

break;

case 'B':

return 3.0;

break;

case 'C':

return 2.0;

break;

case 'D':

return 1.0;

break;

case 'F':

return 0;

break;

default:

break;

}

return 0;

}

int main() {

ifstream inFile;

std::fstream fs;

fs.open ("input.txt", std::fstream::in );

Print_info_one(s);

return 0;

Explanation:

You might be interested in
Which option is used to ensure the integrity and authenticity of a Word document but requires additional services to be availabl
mel-nik [20]

Answer:

Digital signature.

Explanation:

Digital signature is used to ensure the integrity and authenticity of a Word document but requires additional services to be available on the internal network.

This is important as it makes sure that the file is authentic and not malware.

3 0
3 years ago
Read 2 more answers
What is the purpose of the conclusion in an expository essay
AleksAgata [21]

Hi there!

Conclusion restate the thesis and readdress it in light of proof provided .An effective conclusion reminds the reader of the central point of the thesis statement.

Remember the following recommendations:

  • Make the implications of your thesis clear.
  • Widen the significance of your introduction.
  • Recommend a specific course of action.
  • Answer a question posed by the introduction.
  • Reflect on the experience that the essay records.
  • Reaffirm your thesis with a final telling example

Hope this has helped :D

~Adan M

8 0
3 years ago
Read 2 more answers
Karen is designing a website for her uncle's landscaping business. She wants to ensure that it's engaging and provides a lot of
Rashid [163]

Explanation:

Talk About The Benefits. of your  service over other compines

4 0
3 years ago
You are a website designer for a travel website. You have to design an enchanting website. The website should be interactive. Me
levacccp [35]

Answer:

the graphics are lilttle images inside

Explanation:

6 0
4 years ago
Which network model is used by web
BartSMP [9]
D. Wireless connection
3 0
3 years ago
Other questions:
  • What is a task that an internet database allows you to perform
    15·2 answers
  • If you want three vertical sections of text on your page, create _____.
    11·2 answers
  • Two electronics technicians are discussing electrical quantities. Technician A says that resistance is an opposition to electric
    6·1 answer
  • Interpretation is adding meaning to information by making connections and comparisons and by exploring causes and consequences.
    11·1 answer
  • True or False. A list can have only the same data type values.
    13·1 answer
  • The number of colors in a bitmap image determines which category the image will be in. Complete the following sentences.
    15·1 answer
  • 1.       An ________ works for a company to design, carry out, and solve its electronic equipment related problems.
    11·1 answer
  • Write a program that computes how much each person in a group needs to pay (after tax and tip) when splitting the bill equally.
    5·1 answer
  • Being technologically literate requires being able to ______. a. use advanced graphics manipulation tools (adobe photoshop) b. u
    6·1 answer
  • Write the code to call a CSS file named "exam.css".
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!