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

C++ Variable Identification Assignment

Uploaded by

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

C++ Variable Identification Assignment

Uploaded by

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

C++ VARIABLE

IDENTIFICATION

Assignment
SUBMITTED TO: PROF SIR USMAN
SUBMITTED BY: NUDBA NASEER
ROLL NUMBER:- BIT-F24-M29
C++ variable identification Assignment

PART 1: Basic problems

(pattern followed : variable name (data type) –purpose of using )

Problem 1
Solution: Total 4 variables identified in this problem.

Variables identified :

radius r (float/ double )- using it for the decimal number used in problem for the radius

circumference cir (float/double )-using it for the decimal number used in problem for the
circumference which we calculated

pi (float/ double)- using it for the value of pi (3.14)

area (float/ double)- using it for decimal precision for the area we found

Problem 2
Solution :

Total 3 variables identified in this program .

Variable identified :

Name (string)-using it for text for the name of student

Age (int)- for whole number for age of student

GPA (float)- using it for decimal number usedn in problem for the GPA of student about what asked for
print .

Problem 3
Solution:

Total 2 variables identified in this program

Variable identified :

Fahrenhiet/ frn (float)- using it for decimal precision used in the problem to show the temperature in
fahrenhiet
Celcius /cls (float) – using it for decimal precision used in problem to show temperature in celcius

Problem 4
Solution :

Total 4 variables identified in this problem

Variables identified :

Simple intrest /splI (float/double )- using it for decimal precision used in problem for the intrest we
calculated in problem through formula

Principal (float/double) –using it for decimal precision used in the problem for principal amount given in
the problem

Rate (float) – using it for decimal precision used in problem for the rate we intrested in problem as
intrest count

Time (float ) – using it for decimal precision used in problem for the time period .

Problem 5
solution:

Total 2 variables identified in this problem ( it can be one if person is not older than 18 and ineligible
.for voting )

Variables identified :

Age ( int )- using it for whole number used in problem for age of person who is voting .

Eligible/elg ( boolean ) – using to show the eligiblity of person if he is older than 18 .

Problem 6
Solution :

Total 4 variables identified in the problem

Variables identified :

Volume ( float/double) – using it for decimal precision used in problem for the the volume of cylinder
we calculated .

Radius (float/double)- using it for decimal number used in problem for the radius of cylinder we
found.

Hieght (float/double) – using it for decimal precision used in problem for the the hieght of the cylinder
we calculated .
Pi(float/double ) – using it for pi value used in the problem (3.14).

Problem 7
Solution :

Total 4 variables identified in the problem .

Variable identified :

Name (string)- using for text for the name of item we bought .

Price (float/double) – using it for the decimal precision used in problem for the price of item we added
in the shopping cart .

Quantity (int) – using it for whole number for the quantity of item we bought and added in the
shopping cart .

Calculated Coast (float\double) –The calculated coast will be in float or double so the Following variable
will used Because Total money can be in points.

Problem 8
Solution :

Total 3 variables identified in the problem .

Variable identified :

Weight ( float /double ) –using it for decimal number used in problem for person’s weight .

Height (float /double) – using it for decimal number used in problem person’s height .

BMI( float/double) – using it for decimal precision for the total body mass index we calculated .

Problem 9
Solution :

Total 3 variables identified in the problem .


variables identified :

Acc no (string)-using for text to store alphanumeric account number

Balance (float/double)-using for decimal number used in problem to store account balance .

Acc typ (string)-using for text that declare the type of account rather it is for “checking “ or “savings”.
Problem 10
Solution :

Total 4 variables are identified in the problem

Variables identified :

First name (string )- using it for text for first name from collected information

Last name ( string)- using for text last name from personal information

Age (int)-using for age of the person in whole number whom information is collected

Gender (char)- using it for gender which represented in the single character

The end

You might also like