subject

C++ Code Outputs. I have a problem with my code and I don't know how to make it run as the project that I need below.

This is my code:

#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+u nit2);

}

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;

}
In the screenshots i'm showing the inputs and outputs that I need for the test


C++ Code Outputs.

I have a problem with my code and I don't know how to make it run as the projec
C++ Code Outputs.

I have a problem with my code and I don't know how to make it run as the projec
C++ Code Outputs.

I have a problem with my code and I don't know how to make it run as the projec
C++ Code Outputs.

I have a problem with my code and I don't know how to make it run as the projec

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
According to alisa miller foreign news bureaus
Answers: 3
question
Computers and Technology, 22.06.2019 20:40
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it
Answers: 2
question
Computers and Technology, 22.06.2019 21:40
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
Answers: 2
question
Computers and Technology, 22.06.2019 23:50
You need to design a circuit that implements the functions in the following table: s0 s1 function0 0 a + 10 1 a – b1 0 a + b1 1 a – 1s0 and s1 are 1-bit control inputs to select the function of the circuit. inputs a and b are 4-bitnumbers in 2s complement form. the output is also a 4-bit number in 2s complement form.you are allowed to use only one ttl 7483 4-bit adder to implement all the functions. but anynumber of other components (except the adder) can be used.hint: design a combinational logic circuit to modify the input b and the “carry input” of theadder depending on the control inputs s0 and s1.important: lab grade will depend on the working of the circuit & will be checked of by your labinstructor.1. is the output valid for the following input combinations: a. s0 = 0, s1 = 0, a = 7, b = 3? b. s0 = 0, s1 = 1, a = 7, b = 3? c. s0 = 1, s1 = 0, a = -4, b = -5? d. s0 = 1, s1 = 1, a = -8, b = 6? 2. what is the range of inputs (for both a and b) that will produce the valid output for all the functions?
Answers: 3
You know the right answer?
C++ Code Outputs. I have a problem with my code and I don't know how to make it run as the project...
Questions
question
SAT, 18.02.2021 23:00
question
Mathematics, 18.02.2021 23:00
question
Chemistry, 18.02.2021 23:00
Questions on the website: 13722359