C++ Programming Lab: Input and Output, Character, Arithmetic Operations, and Grades, Cheat Sheet of Computer Programming

Various tasks performed during a C++ programming lab. The tasks include entering numbers to find their value using else if conditions, checking if characters are vowels, determining if the sum of two numbers is positive or negative, using logical operators, finding maximum and minimum numbers, and calculating even or odd numbers. Additionally, tasks related to inputting grades and calculating corresponding numbers and grades are included.

Typology: Cheat Sheet

2020/2021

Uploaded on 02/20/2022

unnsa-nazir-nazir-ahmed
unnsa-nazir-nazir-ahmed 🇵🇰

2 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lab NO.5
TASK 1: We can enter number to our c++ program and the script will try to find
number by using series ofelse ifcondition checking. Each if else condition check
for number for a particular number and if it is TRUE then all other checking ( else
if ) are omitted.
Getting the number by using input mark in C programming
Input:
Output:
Input and Output:
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download C++ Programming Lab: Input and Output, Character, Arithmetic Operations, and Grades and more Cheat Sheet Computer Programming in PDF only on Docsity!

Lab NO.

TASK 1: We can enter number to our c++ program and the script will try to find

number by using series of else if condition checking. Each if else condition check for number for a particular number and if it is TRUE then all other checking ( else if ) are omitted. Getting the number by using input mark in C programming

Input:

Output:

Input and Output:

Task 2:

Character: Character data type is used for storing characters. Keyword used for

character data type is char. Characters typically requires 1 byte of memory space and ranges from 128 to 127 or 0 to 255. In this task we write a char variable and in this program we stored the more than one character variable so let’s do the perform program: We have performed the task of Ask the user to enter an alphabet. In output, display that whether the given alphabet is vowel or not. It is done by using if-else conditional statements.

Output:

Task 4: The logical AND (&&) operator (logical conjunction) for a set of

operands is true if and only if all of its operands are true. It is typically used with Boolean (logical) values. When it is, it returns a Boolean value. However, the && operator actually returns the value of one of the specified operands, so if this operator is used with non-Boolean values, it will return a non-Boolean value && Logical and: Returns true if both statements are true || Logical or: Returns true if one of the statements is true ! Logical not: Reverse the result, returns false if the result is true We have to take three inputs from user and find maximum number

Input:

Output:

Task 5: We have to take three inputs from user and find minimum number

Input:

Output:

Task 7: Use if else series to find number from 1 to 100

Input:

Output:

Output:

Task 10: ask number from user and tell day according to input number

Input:

Output:

Task 2: Input:

Lab NO.

Task 1: We can enter mark to our c program and the script will try to find out the

grade by using series of else if condition checking. Each if else condition check for mark for a particular grade and if it is TRUE then all other checking (if) are omitted.

Input:

Output:

Task 2: Enter grade and user will tell you your number according to your grad.

Input:

Output:

Task 2: Assign your 1

st year marks to a variable and take marks of 6 books from user, then sum all these marks and you get grade and percentage according to your marks.

Input:

Output:

Conclusion:

So we have performed all the tasks successfully and also succeeded in fulfilling completion of the required tasks assigned by the instructor