Lab 1 Template
Lab 1 Template
CSCI 1081
Lab 1 Report
1. Introduction
[Write a short ( 1- 3 paragraphs) describing what you did in this lab]
a. What is the common name of the statements that start with the
hash (#) symbol at the top of the C++ program? What is the
purpose of the #include statement?
Answer
Answer
It is where the program begins to execute and it is the starting
point of the code we will write for a particular program.
Answer
Answer
Answer
int main()
{int n_milescommutes;
n_milescommutes =20;
Time_taken= 5;
return 0; }
b. Write a program that takes the number of miles the user commutes
daily and how many minutes it takes him/her. Calculate the speed of
the journey in miles per hour, kilometers per hour, and meters per
second. Display the speed you calculated in the three units. Paste your
solution below this line. You must paste a single solution. Paste your
solution below this line.
#include <iostream>
int main() {
distance_miles, time_minutes;
speed_mph= distance_miles/time_hours;
return 0; }
c. Write a program that takes two numbers as inputs and outputs their
sum. Paste your solution below this line.
#include <iostream>
int main() {
return 0; }
d. Suppose you want to write a C++ program that calculates and displays
the per-head income amount for a family. Ask the user how many
people are in the household and their total gross income. Find and
display the per-head income for the family. Paste your solution below
this line.
#include <iostream>
cout << “ total income earned is” << total_income << “dollars” <<
endl;
cout << “ the per head income is” << per_Headincome <<endl;
return 0; }
e. Write a C++ algorithm that asks the user for the radius of a circle,
calculates its area and circumference, and displays the results along
with some text. Paste your solution below this line.
#include <iostream>
int main() {
cin<< radius;
circumference= 2 * PI * radius;
return 0; }