Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Assignment No.

1 (BIT10A) {Individual Assignment} 
Q.1) Write a program that takes Date of Birth and current date as input from the User and then displays the 
age in years, months and days.                        (5‐Marks) 

Q.2)  
a) Write a program that swaps (interchanges) the values of two variables using third variable.       (3+4) 
Your interaction with the program will be as follows:     

Enter value of a: 15
Enter value of b: 9
After Swapping:
The value of a: 9
The value of b: 15

b) Swap the values of a and b using only two variables. 

Q.3) The setw manipulator specifies the width for an output. The output is printed left‐justified in the 
specified width on the screen:                     (3‐Marks) 

Its syntax is: 
setw (n)

Where n specifies the width of the output field. Read from the book and learn the correct usage of setw() 
 
Write a program to display your Course code, Merit #, age, Matric marks and FSC marks using setw
manipulator. 
For example 
        Course Code    Merit#                    Age   HSSC Marks    SSC Marks 
                         201               1085             18   796       626         
 
Q.4) Write a program to read temperature in Fahrenheit. Convert the temperature to Celsius degrees using 
the formula c=5/9(f‐32).                            (5‐Marks) 
 
Note: Study ‘Escape Sequences’ from your text book and use them for the formatted output where needed. 
\n, \b, \f , \a, \t, \\ are some of the examples of common escape characters. 
 
Q.5) Write the ASCII values of digits from 0‐to‐9, characters from a‐to‐z and characters from A‐to‐Z. 
                          (3‐Marks) 
 
Instructions for Submission 
1. Select A4 Sized Paper with narrow margins 
2. Write the commented code (for each question) in a well formatted manner  
3. The printed copy should be submitted to the SEECS information/ reception desk. 
4. Deadline: 30th  April, 2009 [4:00 PM] 
5. Late submission should be avoided 
6. Contact  :  iftikhar.ahmad@seecs.edu.pk : BICSE‐5/A:  in case of any confusion 

You might also like