Lab Assignment 2_2023FA81814

docx

School

Richland Community College *

*We aren’t endorsed by this school

Course

1436

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

1

Uploaded by AmbassadorEagleMaster689

Report
COSC 1436 Lab Assignment 2 – Basic C++ Programs Write the following C++ programs; then build and run them. When they build and run correctly, copy the code into a separate text file for each program, with the same name as that program. Submit the text files. NOTE: All programs that you write must have comments at the top with the program name, your name, and a sentence describing what the program does. 1. Start a new program called Lab2A and delete everything in it. Then copy the following program segment into it. #include <iostream> using namespace std; int main() { // Write your code here } a. Write statements that declare three int variables: x, y & z b. Write a cout statement to ask the user to input 2 integers separated by a space c. Use the cin statement to input values into x & y d. Set z equal to x * y + 20 e. Write a cout statement that prints the value of z with a label 2. Write a program called Lab2B that calculates the average of 5 test scores. a. Declare 5 double variables named test1, test2, test3, test4, & test5 b. Declare another double variable named average c. Print a statement asking the user for 5 test values separated by spaces. d. Use a cin statement to input the test score variables e. Calculate the average of those test scores. f. Print the average with a label
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help