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

Lab Activities

This document provides instructions for 6 laboratory activities involving writing algorithms and flowcharts in C++. Problem 1 asks students to create a flowchart to compute and print the sum, average, and product of 3 numbers. Problem 2 involves creating a flowchart for a given algorithm that performs calculations based on differences between 2 numbers. Problem 3 asks students to create a flowchart that reads an age and prints if a person can or cannot vote. Problem 4 provides an algorithm and asks students to create a corresponding flowchart. Problem 5 provides instructions to write an algorithm and flowchart to read and print names and scores of 100 students along with calculating the average score. Problem 6 asks students to write a C++ program based on a flowchart they created
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Lab Activities

This document provides instructions for 6 laboratory activities involving writing algorithms and flowcharts in C++. Problem 1 asks students to create a flowchart to compute and print the sum, average, and product of 3 numbers. Problem 2 involves creating a flowchart for a given algorithm that performs calculations based on differences between 2 numbers. Problem 3 asks students to create a flowchart that reads an age and prints if a person can or cannot vote. Problem 4 provides an algorithm and asks students to create a corresponding flowchart. Problem 5 provides instructions to write an algorithm and flowchart to read and print names and scores of 100 students along with calculating the average score. Problem 6 asks students to write a C++ program based on a flowchart they created
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

LABORATORY

ACTIVITIES
Problem #1: (10 points)

Given three numbers A,B,C. Draw a flowchart to


compute and print out the sum, the average, and the
product of these values.
Problem #2: (10 points)
Create a flowchart from the
given algorithm below.

Step 1: read in the values of X and Y. Step 2:


subtract Y from X.
Step 3. If the difference between the X and Y is
negative, compute R=X+Y; if zero, compute r=2x+2y;
and if positive, compute R=X*Y.
Problem #3 (10 points)

Create a flowchart that will input age and


print the string can vote if the age is >= to 18
otherwise print the string cannot vote.
PROBLEM #4 (10 points)

CREATE YOUR OWN FLOWCHART FROM THE GIVEN ALGORITHM BELOW:

Step 1. Initialize the counter (CTR) and accumulator (SUM) to


zero. Step 2. Read in the student’s name and score.
Step 3. Print out the student’s name and score.
Step 4. Accumulate the data value (SCORE) into the sum. Step 5. Test if
the desired amount of data (100) has been reached. Step 6. If the
value of counter (CTR) is less than 100, repeat steps 2 through 5.
However, if the desired amount of the data has been reached,
compute the average score by dividing the sum by the value of
counter.
Step 7. Print out the average score.
➢ 5. Write an algorithm then create a flowchart which will read and print
the names and individual scores of 100 students for a particular
examination. You need also to determine their average score, and
display or print it out.

(25 points)
➢ 1. Debug – will the following program work? #score (5 points) Include
<iostream>
using namespace std;
int main(){cout <<“Hello there world!”; return 0; }

2. Modify – Rewrite to conform to good programming and correct syntax.


1. include <iostream>
int main (
){
cout <<
“This is the moment.”
; return 0; }
#score (5 points)
➢ 3. Debug - #score (10 points)

#include <iostream.h>
using namespace std:
int main
{ cout << “Every c++ program”
: cout
<<“\nmust have one and only
one” ;
cout << “main (} function”
;
cout <<
“\n the escape sequence of
characters” ; cout <<
“\nfor new line can be placed
anywhere” ; cout
<<“\n within the message passed to
cout” ; return 0;}
➢ 4. A C++ program is required to display the
following name and address: Design your program.

Mr. S. Azlet
63 Seminole Way
Dumont, NJ 07030

#score (10 points)


➢ 5. Write a C++ program that stores the number 105.62 in the variable
firstnum, 89.352 in the variable secondnum and variable 98.67 as
thirdnum. Have your program calculate the sum of the three
numbers and their average. The sum should be stored in variable to
total and the average should be stored in variable average. The
total and average must be displayed.

#score (20 points)

6. Write a C++ program from the flowchart that you created in slide
4 or Problem #3.

#score (15 points)


Submission – TBD

“Don’t forget to Design your Program”

You might also like