For each problem:
Write the code including parts similar to Problem A1:
Name the program: ProblemB1.cpp
Provide an opening comment giving your name, CIS 22A with
term, assignment, problem, and a very short description of
what the program does
code the preprocessor #include for iostream
code the C++ statement to use the namespace std
code the heading line for the main function and
opening brace
Then write the code for problem B1:
Declare an integer variable named: cats
Declare an integer variable named: dogs
Declare an integer variable named: animals
Use cout to print a prompt telling the user to enter
a value for cats. Use a string "ending with colon space" and
no endl for this prompt.
Then use cin to reade a value into the variable cats.
In the same manner, get the value for dogs from the user.
Assign the sum of cats and dogs to the variable animals.
Printing multiple items on the same line was done in Assignment A;
you can print in a similar way.
Print in one line: "cats: " , the value of the variable cats, and endl.
In the same manner print dogs.
In the same manner print animals.
Align the quote marks (important) and align the << (not important)
Then code the return 0, closing brace, and Execution results
as in problem A1
Use an Interactive Development Environment (IDE) to build,
correct errors, and execute your program.
Copy everything printed by your program and paste them in the
Execution results
Complete problem B2 also and upload both of them at the same time into Canvas
Write the code including parts similar to
Problem A1 and B1:
Name the program: ProblemB2.cpp
Provide an opening comment giving your name, CIS 22A with
term, assignment, problem, and a very short description of
what the program does
code the preprocessor #include for iostream
code the C++ statement to use the namespace std
code the heading line for the main function and opening brace.
Then write the code for problem B2:
Declare an int named a with an initial value of 4
Declare an int named b with an initial value of 2
Declare an int named c with an initial value of 2
Use these variables in your program.
Assign a value to the variable named c by using the += operator
to increase its value by the value of the variable b
Assign a value to c equal to the value of the variable b plus
the product of a times c
Print in one line: "result: " , the value of the variable c, and endl
Then code the return 0, closing brace, and Execution results
as in problem A1
Use an Interactive Development Environment (IDE) to build,
correct errors, and execute your program.
Copy everything printed by your program and paste them in the
Execution results
Complete problem B2 and upload both B1 and B2 at the same time into Canvas