Sample Programming Lab Report (1)
Sample Programming Lab Report (1)
Report
LAB Report # 1
Submitted To:
Submission Date:
Objective(s):
To be familiar with syntax and structure of C++ programming.
To learn problem solving techniques using C++
Title No 1:
Define your first and last names initials as two different variables print your name initials as
combination of two individual variables. Also write algorithum, flow chart and codes.
Algorithm:
1. Start.
2. Declare variable for the first name variable first name_M.
3. Declare variable for the last name variable last name_D.
4. Combination of name initials.
5. Display name.
6. End
Flowchart:
Start
First_name
Last_name
Display combination
End
Code:
#include<iostream>
Using namespace std;
Int main()
{
Char first vaiable =’M’;
Char last variable=’D’;
Cout<<”my initials are:”<<firstname<<lastname<<endl;
Return 0;
Title No 2:
Write a program to take in the age of user and display the output on screen.
Algorithm:
1. Start
4. Read the input from the user and store it in the variable ‘age’
5. Print the message “You Are” followed by the value of ‘Age’ to the screen and at the last
“Years old”.
6. End
Flowchart:
Start
Display age
End
Code:
#include <iostream>
Using namespace std;
Int main()
{
Int age ;
Cout<< “Enter your age:18”;
Cin>>age;
Cout<< “you are” << age << “years old.”<<”\n”;
Return 0;
}
Enter temperature in
celsius
F=(Celsius*9/5)+32
Display result
End
Code:
#include <iostream>
using namespace std;
int main()
{
float celsius,fahrenheit;
cout << "enter temperature in celsius:";
cin>>celsius;
fahrenheit=(celsius *9.0/5.0)+32;
cout<<celsius<<"degree celsius is equal to"<<fahrenheit<<"degree fahrenhiet."<<"\n";
return 0;
}