Docsity

C++ basic programs exercise, Assignments of Linear Programming

Partial preview of the text

Download C++ basic programs exercise and more Assignments Linear Programming in PDF only on Docsity!

Degree:

BS SE Evening

Semester

nd

semester

Course no.:

CS 308

Registration no.:

2024-ag-

Submitted by :

Muhammad

Ammar

Submitted to:

Sir Arsal Mahmood

• Prompt user to enter a

value. Check if the number is

even then display a message

that number is even. If

number is odd then display

message number is odd

Include Using namespace std; Int main() { Int A; Cout << “Enter a number; Cin >> A; If (A%==20) { Cout << A <<”: is an even number”; } If (A%2!=0) {

If (Age>= 18) { Cout << Age <<”: you are eligible for Id card “; } If (Age< 18) { Cout << Age<< “: you are not eligible for id card”; } }

• Develop a calculator which

is able to handle two

numbers. The calculator can

perform addition,

subtraction, multiplication,

and division.

#include

Using namespace std; Int main() { Int x, y; Char opChoice; Cout << “x”; Cin >> x; Cout << “y”; Cin >> y; Cout << “Enter operator (*,-,+,/)”;

Cin >> opChoice ;

If (opChoice == ‘+’) { Cout << x << “+” << y << “=”<< x+ y;