0% found this document useful (0 votes)
79 views

C++ Sample Coding

This C++ program provides a menu for a student to select different activities, quizzes, and exams completed as part of an ICT4 programming course. The user enters a letter choice, and the corresponding code displays the relevant activity or quiz questions, accepts user input, performs calculations, and displays results before returning to the main menu. This allows the student to review past work and practice programming concepts from the course.

Uploaded by

johannavillar18
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

C++ Sample Coding

This C++ program provides a menu for a student to select different activities, quizzes, and exams completed as part of an ICT4 programming course. The user enters a letter choice, and the corresponding code displays the relevant activity or quiz questions, accepts user input, performs calculations, and displays results before returning to the main menu. This allows the student to review past work and practice programming concepts from the course.

Uploaded by

johannavillar18
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

#include <iostream>

#include <string>

using namespace std;

void main()

string quit,x;

do

system ("cls");

system ("color 17");

cout<<"THIS PROGRAM IS A COMPILATION OF ALL THE ACTIVITIES,QUIZZES AND EXAM


IN ICT4 -- PROGRAMMING\n\n";

cout<<"A. Activity 1\n";

cout<<"B. Activity 2\n";

cout<<"C. Activity 3\n";

cout<<"D. Activity 4\n";

cout<<"E. Activity 5\n";

cout<<"F. Midterm quiz 1\n";

cout<<"G. Midterm quiz 2\n";

cout<<"H. Midterm exam \n";


cin>>x;

if (x=="C"||x=="c")

system ("cls");

system ("color 71");

int a, b, c, d, e, sum, difference, product, quotient;

cout<<"ACTIVITY 3\n\n\n";

cout<<"Enter first no: ";

cin>>a;

cout<<"\n";

cout<<"Enter second no: ";

cin>>b;

sum=a+b;

cout<<"The sum of first and second no is ";

cout<<sum;

cout<<"\n\n\n";
cout<<"Enter third no: ";

cin>>c;

difference=sum-c;

cout<<"The difference of third no and the sum is ";

cout<<difference;

cout<<"\n\n\n";

cout<<"Enter fourth no: ";

cin>>d;

product=difference*d;

cout<<"The product of difference and the fourth no is ";

cout<<product;

cout<<"\n\n\n";

cout<<"Enter fifth no: ";

cin>>e;

quotient=product/e;

cout<<"The quotient of product and the fifth no is";

cout<<quotient;

cout<<"\n\n\n";

cout<<"Do you want to quit? ";

cin>>quit;

else if(x=="D"||x=="d")
{

system ("cls");

system ("color 71");

char name[100],

address[100],

section[100],

school[100],

course[100];

cout<<"ACTIVITY 4\n\n\n";

cout<<"Name: ";

cin.getline(name,100);

cout<<"\n\n";

cout<<"Address: ";

cin.getline(address,100);

cout<<"\n\n";

cout<<"Section: ";

cin.getline(section,100);

cout<<"\n\n";
cout<<"School: ";

cin.getline(address,100);

cout<<"\n\n";

cout<<"Course: ";

cin.getline(course,100);

cout<<"\n\n";

cout<<"Hello ";

cout<<name;

cout<<" !";

cout<<" You are a ";

cout<<course;

cout<<" at ";

cout<<school;

cout<<" and you belong to ";

cout<<section;

cout<<" section.";

cout<<"\n\n\n";

cout<<"Do you want to quit? ";

cin>>quit;

else if(x=="F"||x=="f")

{
system ("cls");

system ("color 71");

char name [50];

float a,b,c,average;

cout<<"MIDTERM QUIZ 1\n\n\n";

cout<<"Name: ";

cin.getline(name,50);

cout<<"\n\n";

cout<<"Prelim: ";

cin>>a;

cout<<"Midterm: ";

cin>>b;

cout<<"Finals: ";

cin>>c;

average=(a+b+c)/3;
cout<<name;

cout<<"'s Final Grade is ";

cout<<average;

cout<<"\n\n\n";

cout<<"Do you want to quit? ";

cin>>quit;

else if(x=="G"||x=="g")

system ("cls");

system ("color 71");

float a,b;

cout<<"Enter first number";

cin>>a;

cout<<"Enter second number";

cin>>b;

cout<<"The highest number is ";

if(a>b)

cout<<a;
}

else

cout<<b;

while(quit=="n"||quit=="N");

You might also like