Question: write a program that will show the following output Using cout Statement?
a)
**************************************************
** PROGRAMMING ASSIGNMENT 1 **
** Language C++ **
** Compiler BORLAND C **
**************************************************
b)
******** ******* * *
* * * * *** * *
* * * * ***** * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
******** ******* * *
c)
* ****** * *
*** * * ** **
***** * ** ** * * * * *
************* * * * * *
*********** * **** * * * * *
**** **** * * ** **
*** *** ****** * *
* *
d)
** ** ** ** ********
** ** ** ** ********
** ** ** ** **
** ****** **
** ** ** **
** ** ** ********
** ** ** ********
e)
******** ** **
******** ** **
** ** **
** ************ ************
** ************ ************
** ** **
******** ** **
******** ** **
f)
* * * *
*** ** *** **
***** *** ***** ***
******* **** *** *** ****
********* ***** *** *** *****
*********** ****** *** *** ******
************* ******* *** *** *******
*************** ******** *** *** ********
Question: write a program that will Display Your First Name, Last Name, Date of Birth…etc
Sample Output:
My First Name is Abc
My Last Name is Xyz
My Date of Birth
........ And So on
Question: Write A program which will inputs three integers from the user and print the Sum, Average, Difference, Product and division and remainder of only 1st two numbers ?
Sample Output:
Enter 1st Integer: 4
Enter 2nd Integer: 8
Sum of Integers = 12
Difference of Integers = -4
....... And So on
Question: Write a program that will get any integer from the user and print the table of that value from 1 – 10?
Sample Output:
Enter a Number for Table Display: 5
5 x 1 = 5
5 x 2 = 10
....... And So on
Question: Write a program that will inputs the five digit number, separate the number into its individual digits and print the digits separated from one another by three spaces each (Hint: Use the integer division and modulus operators.
Sample Output:
Enter a Five Digit Number: 26519
Your Entered Number: 2 6 5 1 9
Question: Write a program that will get the date of birth of the user and print the age of the user Assume that the current year is 2009 and current month is 10. Now calculate?
Sample Output:
Enter the Your Date of Birth: 22 September 1986
Your Current Age is: 23
Question: Write a program that will show the Size of all the data types using "sizeof()" keyword (take Help from The Help Of Borland C by pressing F1).
Sample Output:
The size of unsigned char is : 1 Byte/8 Bits
The size of char is : 1 Byte/8 Bits
The size of unsigned int is : 4 Byte/32 Bits
The size of short int is : 2 Byte/16 Bits
....... And So on
Question: Write a program that calculates the length of the hypotenuse of the right angle triangle? Get the Value of two sides of the right triangle and show the result by making a particular formula?
Sample Output:
Please Enter the vlaue of 1st Side: 2.6
Please Enter the value of 2nd Side: 6.8
Your First Enter value is 2.600000
Your Second Enter value is 6.800000
Answer is 7.280110
Question: Write a program that takes as input given length expressed in feet and inches. The program should then convert the output the length in centimeters. Assume the given Length in feet and inches are integers.
Sample Output:
Enter two integers one for feet and one for inches separated with space: 15 7
The Number you entered are 15 for feet and 7 for inches
The Total Number of Inches = 187
The Total Number of Centimeters = 474.98
Question: Write a Program that takes Pak Rupees as an Integer and the Display it in US Dollar (Assume 1US Dollar = 75Pak Rupees).
Sample Output:
Enter the Amount in Pak Rupees: 1
This Amount in US Dollar = 75
Question: Write a program that prompts the user to input the length and width of a rectangle and then print the rectangle’s area and perimeters (Assume that the length and the width are decimal numbers) (A = Width x Height, P = Width2 + Height2).
Sample Output:
Enter the length of triangle: 6
Enter the width of triangle: 8
Area = 48
Parameters = 28
Question: Write a program that will get the amount added in the account of a person and will show the amount of 10 years including interest per month. The rate of interest per month will be 0.005. Your program should only display the result of each year not of the months.
Sample Output:
Enter the Total Amount Added in your Account: 500
The Total Amount After first year: 530
The Total Amount After Second year: 561
The Total Amount After Third year: 594
....... And So on
Question: Write a program that prompt the user to enter five test scores and then prints the average test score. (Assume that the test score are decimal numbers).
Sample Output:
Enter 1st Test Score: 25
Enter 2nd Test Score: 60
Enter 3rd Test Score: 44
Enter 4th Test Score: 49
Enter 5th Test Score: 31
Average is = 41.8
Question: Write a Program that prompts the user to input five decimal numbers in one Line Separated with Space. The program should then add the five decimal numbers, convert the sum to the nearest integer, and print the result.
Sample Output:
Enter the Five Decimal Numbers: 25 3.4 68.3 9 4.1
The Sum of these Decimal Numbers is = 109.8
Number Round to = 110
Question: Write a program the does the following:
Prompts the user to input five decimal numbers
Prints the five decimal Number
Converts each decimal number to the nearest Integer
Add the five integers
Print the sum and average of the five integers.
Sample Output:
Enter the 1st Decimal Number: 6.4
Enter the 2nd Decimal Number: 8.8
....... And So on
Your Entered 1st Decimal Number: 6.4
Your Entered 2nd Decimal Number: 8.8
....... And So on
1st Decimal Number Round to: 6
2nd Decimal Number Round to: 9
....... And So on
Sum of all Decimal Numbers = 216
Average of all Decimal Numbers = 43.2
Question: Write a Program that prompts the user to input a four-digit positive integer. The program then outputs the digits of the number, one digit per line.
Sample Output:
Enter the four-digit positive integer: 5623
5
6
2
3
Question: Write a C++ program that prompts the elapsed time for events in seconds. The program then outputs the elapsed time in hours, minutes and seconds.
Sample Output:
Enter the Elapsed Time: 9630
Time in Hours, Minutes and Seconds = 2:40:30
Question: Write a program that prompts the user to input the elapsed time for an event in Hours, Minutes and Seconds. Then Program outputs the elapsed time in Seconds.
Sample Output:
Enter the Time Separate by ‘:’ in Hours, Minutes and Seconds: 2:40:30
Time in Seconds = 9630
Question: Write a program that prompts the user to input the original price of five and sold price of five products and then display the total profit amount.
Sample Output:
Enter the Original price of 1st product: 5000
Enter the Original price of 2nd product: 2500
....... And So on
Enter the Sold price of 1st product: 6200
Enter the Sold price of 2nd product: 3000
....... And So on
Total Profit Amount = 6260
Question: Write a Program that prompts the user to input a length expressed in centimeters. Then the output the length expressed in yards, feet and inches. (Note: 1yard = 36inches, 1feet = 12inches).
Sample Output:
Enter the Length in Centimeters: 123
3 yard(s), 1 feet(foot), and 3 inch(es)
....... And So on
Question: Write a program that prompts the user to enter the two different dates and your program should be then display their difference in days.
Sample Output:
Enter 1st Date: 9-9-2009
Enter 2nd Date: 22-9-2009
Difference in Day(s) = 13
Question: Write a program that prompts the user to enter the GPA of five Semesters then it will calculate the CGPA of five Semesters.
Sample Output:
Enter the GPA of 1st Semester: 3.5
Enter the GPA of 2nd Semester: 2.9
Enter the GPA of 3rd Semester: 3.12
Enter the GPA of 4th Semester: 3.14
Enter the GPA of 5th Semester: 2.75
CGPA of all Semesters = 3.08
Question: Write a Program that prompts the user to input a Number in Decimal then Display that Number in two parts separated at point.
Sample Output:
Enter a Decimal Number: 36.5254
Number = 36
Floating Point = 5254
Question: Write a Program that prompts the user to input a String and Display the ASCII value of each character (ASCII value should be separated by Space).
Sample Output:
Enter a String: abcdef
ASCII value of “abcdef” = 97 98 99 100 101 102
Question: Write a Program that prompts the user to input an ASCII value and Display its Character.
Sample Output:
Enter a ASCII value: 106
Character = j
Question: Write a program that prompts the user to input a Decimal Number and then outputs this number rounded to two decimal places.
Sample Output:
Enter a Decimal Number: 632.22145
Your Entered Number Rounded to two Decimal Places = 632.22
Question: Write a program that Convert the Fahrenheit Temperature to Centigrade. The Formula for Converting the Temperature is C = (5 / 9) x (F – 32).
Sample Output:
Enter Temperature in Fahrenheit: 135
Temperature in Centigrade = 57.222222
Question: Write a Program that will take Input a String and Then Display next Character from each Character.
Sample Output:
Enter a String: Hello World
Result = Ifmmp Xpme
Question: Write a Program that will get the marks of the student from the user out of 100 and print the grade of the student according to the following rules:
If mark >=85 Then Grade is A
If 80<=marks<85 Then grade is A-
If 75<=marks<80 Then grade is B
If 70<=marks<75 Then grade is B+
If 65<=marks<70 Then Grade is C
If 60<=marks<65 Then Grade is C+
If 50<=marks<60 Then grade is D
If Marks <50 Then Fail (F)
Sample Output:
Enter your Marks: 82
You got A- Grade
Question: Write a Simple Calculator Using If Else Statement that prompts the user to Input two Numbers. Then it will Display the Menu for Addition, Subtraction, Multiplication, Division, Square of 1st Number, Cube of 1st Number, Sin, Cos, Tan. After any choice it will Display the Answer.
Sample Output:
Enter the 1st Number: 6
Enter the 2nd Number: 9
*****MENU*****
Press 1 for Addition of these Numbers
Press 2 for Subtraction of these Numbers
....... And So on
Enter your Choice: 1
Addition of 6 and 9 is = 12
Question: Write a program that will input a number from user from 0 - 9999, and the computer checks that whether the entered value is 1 digit value or 2 digit value or 3 digit value or 4 digit value.
Sample Output:
Enter a Number between 0 to 9999: 682
You have entered 3 Digit Number
Question: Write a Program that prompts the user to input a Number 0-10 and Display that Number in Word.
Sample Output:
Enter a Number: 7
Seven
Question: Write a program that prompts the user to input two Integer Number and Then Compare them and Tell either both Numbers are Equal or Not.
Sample Output:
Enter 1st Number: 82
Enter 2nd Number: 83
Both Numbers are Not Equal
Question: Write a program that prompts the user to input four Integers and then Display which Number is Greater and which one is Smaller.
Sample Output:
Enter 1st Number: 9
Enter 2nd Number: 15
Enter 3rd Number: 10
Enter 4th Number: 8
Greater Number = 15
Smaller Number = 8
Question: Write a program that will take number from user and print its pronunciation (1 - 100). The number 85 is pronounced "eighty-five," not "eight five." For example, 13 would be "thirteen" and 100 would be "one hundred."(Do with Minimum Number of statements to get Extra Credit, if control statements are more than 50 then zero marks will be given).
Sample Output:
Enter number: 10
You have Entered Ten
Do another (y/n)? y
Enter number: 12
You have Entered Twelve
Do another (y/n)? n
Question: Write a program that prompts the user to input a number. The program should then output the number and a message saying whether the number is positive number, negative number or zero.
Sample Output:
Enter number: 10
Your have Entered a Positive Number
Do another (y/n)? n
Question: Write a Program that will get the a Single Character and Tell either it is Vowel or Not using SWITCH Statement (Your Program should Support the upper and Lower Case).
Sample Output:
Enter a Character: e
It’s a Vowel
Continue... (y/n): y
Enter a Character: E
It’s a Vowel
Continue... (y/n): n
***** PROGRAM TERMINATE *****
Question: Write a Simple Calculator using SWITCH Statement that prompts the user to Input two Numbers. Then it will Display the Menu for Addition, Subtraction, Multiplication, Division, Square of 1st Number, Cure of 1st Number, Sin, Cos, Tan of 1st Number. After any choice it will Display the Answer.
Sample Output:
Enter the 1st Number: 6
Enter the 2nd Number: 9
*****MENU*****
Press 1 for Addition of these Numbers
Press 2 for Subtraction of these Numbers
....... And So on
Enter your Choice: 1
Addition of 6 and 9 is = 12
Question: Write a Program using SWITCH Statement that prompts the user to input a Number 0-10 and Display that Number in English.
Sample Output:
Enter a Number: 7
Seven
Question: Write a temperature-conversion program that gives the user the option of converting Fahrenheit to Celsius or Celsius to Fahrenheit. Output should be in Decimal .Using SWITCH Statement.
Sample Output:
Press 1 for Convert Fahrenheit to Celsius
Press 2 for Convert Celsius to Fahrenheit
Press 3 for Exit Program
Enter your Choice: 1
Enter Temperature in Fahrenheit: 70
70 Fahrenheit in Celsius = 21.111111
Question: Create the equivalent of a four-function calculator. The program should request the user to enter a number, an operator, and another number. (Use floating point.) It should then carry out the specified arithmetical operation: adding, subtracting, multiplying, or dividing the two numbers. Use a switch statement to select the operation. Finally, display the result.
When it finishes the calculation, the program should ask if the user wants to do another calculation. The response can be ‘y’ or ‘n’. Using SWITCH Statement.
Sample Output:
Enter first number, operator, second number: 10/3
Answer = 3.333333
Do another (y/n)? y
Enter first number, operator, second number: 12+100
Answer = 112
Do another (y/n)? n
*****PROGRAM TERMINATE*****
BEST OF LUCK
Regards: HASEEB MUGHAL
{[['
']]}

0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.