Wednesday, November 27, 2013

A C++ Program That Prints Pyramid of Letter 'X'

OUTPUT:
                 X
               XXX
            XXXXX
         XXXXXXX
       XXXXXXXXX

Monday, November 25, 2013

A C++ Program That Prints English Alphabets

OUTPUT:
            A          B           C         D          E          F         G
            H          I            J          K          L         M        N
            O          P           Q         R          S          T         U
            V          W          X         Y          Z
NOTE:
A=65               ;              Z=90



Sunday, November 24, 2013

A C++ Program That Prints Fibonacci Series

Fibonacci series is given by:
first,second,sum of first and second..............
for example: 0,1,1,2,3,5,8.................







Wednesday, November 20, 2013

C++ Program That Converts Any Given Year Into Its Roman Equivalent Using Functions

 Write a general-purpose function to convert any given year into its roman equivalent. The following table shows the roman equivalents of decimal numbers:

Tuesday, November 19, 2013

Write a C++ Program in Which There Are Two Functions:One That Receives Marks Received By a Student in Three Subjects and Returns the Average and the Second Calculates the Percentage of these marks. Call the Function Average From main( ) and Call the Function for Percentage Calculation in the Function Average and Print the Results in main( ).

     Write 2 functions: 1 that receives marks received by a student in three subjects and returns the average and the second calculates the percentage of these marks. Call the function average from main( ) and call the function for percentage calculation in the function average and print the results in main( ).

Sunday, November 17, 2013

Saturday, November 16, 2013

C++ Program to Help the Car Buyer Analyze the Expected Price of Driving Her New Car

Write a C++ program to help the car buyer analyze the expected price of driving her new car. This program presents the user with a list of five cars (Corolla, City, Civic, Vitz, Swift ) and their expected miles per gallon (mpg) is provided for each car.
Select two cars
i. enter the number of miles driven each year
ii.enter the average price for a gallon of petrol
i.The program then displays the yearly total number of gallons required by the 2 cars selected
ii.total cost of fuel per year
iii.shows the difference in cost between the two vehicles selected
The five cars are: Corolla, City, Civic, Vitz, Swift






Friday, November 15, 2013

C++ Program That Converts the Distance Values Input by the User

Write a C++ program that converts distance values. The program should give the user three outputs:
            Convert:
 i.Whole number of inches to feet &inches (80 inches = 6 ft, 8 in)
ii.Feet and inches to decimal feet (5 feet, 6 inches = 5.5 feet)
iii. Feet and inches to inches (4 feet, 2 inches = 50 inches)
 (1 foot = 12 inches)     

Tuesday, November 12, 2013

C++ For Loop Program Conversion to If Else Statement Program

Given the following C++ code:
     int j, sum = 0;     for (j = 0; j < 10; j++)     sum += j;
     cout<<sum;
Re-write the C++ statements so that they compute the same quantity but using decision statement (if-else) instead of for loop.

Monday, November 11, 2013

C++ Program That Prints the Insurance Fee to Pay for a Pet

Write a program that prints the insurance fee to pay for a pet according to the following rules:
1)A dog that has been neutered costs $40.
2)A dog that has not been neutered costs $50.
3)A cat that has been neutered costs $450.
4)A cat that has not been neutered costs $65.
5)A bird or reptile costs nothing.
6)Any other animal generates an error message.
The program should prompt the user for the appropriate information, using a code to determine the kind of animal (i.e. D or d represents a dog, C or c represents a cat, B or b represents a bird, R or r represents a reptile, and anything else represents some other kind of animal).
After printing the insurance fee, the program should ask the user if (s)he wants to insure another animal.

Sunday, November 10, 2013

C++ Program That Calculates the Obtained Marks and Determines The Division of Student.Using Switch Statement

The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules:
a. Percentage above or equal to 60 - First division
   b. Percentage between 50 and 59 - Second division
c. Percentage between 40 and 49 - Third division
d. Percentage less than 40 – Fail

Saturday, November 9, 2013

C++ Program That Calculates the Obtained Marks and Determines The Division of Student

The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules:
a. Percentage above or equal to 60 - First division
   b. Percentage between 50 and 59 - Second division
c. Percentage between 40 and 49 - Third division
d. Percentage less than 40 – Fail