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

Assignment No.1: (BIT10A)

The document provides instructions for an individual assignment with 5 questions. Question 1 asks to write a program that takes date of birth and current date as input and displays the age in years, months, and days. Question 2 asks to write programs that swap the values of two variables using a third variable and using only two variables. Question 3 asks to write a program that displays formatted output using the setw manipulator. Question 4 asks to write a program to convert Fahrenheit to Celsius. Question 5 asks to write the ASCII values of digits and letters. The document provides instructions on submitting the printed coded answers.

Uploaded by

Usama Javed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Assignment No.1: (BIT10A)

The document provides instructions for an individual assignment with 5 questions. Question 1 asks to write a program that takes date of birth and current date as input and displays the age in years, months, and days. Question 2 asks to write programs that swap the values of two variables using a third variable and using only two variables. Question 3 asks to write a program that displays formatted output using the setw manipulator. Question 4 asks to write a program to convert Fahrenheit to Celsius. Question 5 asks to write the ASCII values of digits and letters. The document provides instructions on submitting the printed coded answers.

Uploaded by

Usama Javed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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  :  [email protected] : BICSE‐5/A:  in case of any confusion 

You might also like