Professional Documents
Culture Documents
Report 1
Report 1
Submitted To:
Submitted By:
int main()
{
// Declare four string variables to store user input
string w, x, y, z;
Line 1: This line includes the iostream header file, which provides the cout and cin objects that
are used to print and read text from the console.
Line 2: This line uses the using namespace std; statement to import all the names from the std
namespace into the current scope. This means that we can refer to the cout and cin objects
without having to prefix them with std::.
Line 4: This line declares four string variables to store the user's name, university name, section, and
student ID.
Line 7: This line uses the getline() function to read the entire line of input, including spaces. The
getline() function takes two arguments: the first argument is a reference to a string object, and the
second argument is a reference to an input stream object. In this case, the first argument is the w
variable, and the second argument is the cin object.
Lines 9-12: These lines are similar to lines 6-8, except that they prompt the user to enter their
university name, section, and student ID.
Lines 14-18: These lines display the collected information with labels. The cout object is used to
print the text to the console.
Line 19: This line returns 0 to indicate that the program has executed successfully.