CSE 100: Principles of Programming with C++
School of Computing and Augmented Intelligence, Ira A. Fulton Schools of Engineering
Arizona State University, Tempe.
Homework 1 (5 points)
Note: This is an individual assignment. You have to submit individual work. If your work
matches with other students’ work or anything available online, you will be reported to the
Academic Integrity Office.
Write the output for the following code segments.
Assume that the required headers are included in order to compile code segments. After compilation,
the output seen on the screen (standard output) is what you have to answer for each code segment.
Question 1: (0.5 points for each line of cout)
int main()
{
cout << "My first C++ program.";
cout << "The sum of 2 and 3 = " << 5;
cout << "7 + 8 = " << 7 + 8;
return 0;
}
Question 2: (0.5 points for each line of cout)
int main()
{
cout << "My first C++ program." << endl;
cout << "The sum of 2 and 3 = " << 5 << endl;
cout << "7 + 8 = " << 7 + 8 << endl;
return 0;
}
Question 3: (0.5 points for each line of cout answered correctly and 0.5 points for \t correct use)
int main()
{
cout << "\t\t\t\ My first C++ program." << endl;
cout << "The sum of 2 and 3 = " << 5 << endl;
cout << "7 + 8 = " << 7 + 8 << endl;
return 0;
}
Submission Instructions: Include the answers to all the above questions and any required
explanation. The file can be in txt, word (doc, docx) or pdf format.