0% found this document useful (0 votes)
83 views3 pages

Basic Programming Using C++ Input/ Output (Cin/cout Object)

The document provides instructions for a programming assignment to write a C++ program that calculates a student's general weighted average (GWA). The program should prompt the user to enter a student name, two course codes and units, and grades. It will then display the student name, courses/units/grades table, calculate the total units, and output the GWA. A sample run is provided, as well as the source code that implements the program according to the instructions.

Uploaded by

Henryx Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views3 pages

Basic Programming Using C++ Input/ Output (Cin/cout Object)

The document provides instructions for a programming assignment to write a C++ program that calculates a student's general weighted average (GWA). The program should prompt the user to enter a student name, two course codes and units, and grades. It will then display the student name, courses/units/grades table, calculate the total units, and output the GWA. A sample run is provided, as well as the source code that implements the program according to the instructions.

Uploaded by

Henryx Santos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES

QUEZON CITY
COLLEGE OF INFORMATION TECHNOLOGY EDUCATION (CITE)
ITE001- Computer Programming 1

NAME:
PROGRAM/SECTION:
ASSESSMENT TASK: Basic programming using C++ Input/ Output (cin/cout object)

The following question supports the attainment of Course Intended Learning Outcomes (CILO): Identify the
components, features, characteristics and uses of C++ Language in various applications; and Design
computing-based solution using control structures, functions, array and other statements.

Instruction: Write a program that will let the user to enter: Student Name, two Subject Code, two Subject
Units and two Subject Grade. The program will compute and display the student General Weighted
Average(GWA).

Filename: SurnamePrelimActivity2.cpp
Variables: studName, cCode1, cCode2, cUnit1, cUnit2, cGrade1, cGrade2, totUnits, gwa=0.
Formula: totUnits=sUnit1 + sUnit2
gwa= ((cGrade1*cUnits1)+( cGrade2*cUnits2))/ totUnits

SAMPLE OUTPUT
Enter student name: Jasmin
Enter course code 1: ITE 001
Enter course grade 1: 95
Enter course unit 1: 4
Enter course code 2: ITE011
Enter course grade 2: 97
Enter course unit 2: 3

Student Name: Jasmin

COURSES Units Grade


ITE001 4 95
ITE011 3 97

General Weighted Average(GWA) = 95


Source Code: paste the source code here

#include <iostream>
using namespace std;
int main(){
char studName[30];
int cGrade1, cGrade2, cUnit1, cUnit2, totUnits;
string cCode1, cCode2;
int gwa = 0;
cout<<("Enter Student Name:");
cin.getline(studName,30);

cout<<("Enter Course Code 1:");


getline(cin, cCode1);

cout<<("Enter Course Grade 1:");


cin>>cGrade1;

cout<<("Enter Course Unit 1:");


cin>>cUnit1;

cout<<("Enter Course Code 2:");


cin.ignore();

getline(cin, cCode2);
cout<<("Enter Course Grade 2:");
cin>>cGrade2;

cout<<("Enter course Unit 2:");


cin>>cUnit2;

totUnits=cUnit1 + cUnit2;

cout<<endl;
cout<<"Student Name: "<<studName<<endl;

cout<<"COURSES UNITS GRADE\n";


cout<< cCode1<<" "<<cUnit1<<" "<<cGrade1<<("\n");
cout<< cCode2<<" "<<cUnit2<<" "<<cGrade2<<("\n");

totUnits=cUnit1 + cUnit2;
gwa=((cGrade1*cUnit1)+(cGrade2*cUnit2))/totUnits;
cout<<endl<<"General Weighted Average (GWA)=" <<gwa<<endl;
}

You might also like