Professional Documents
Culture Documents
Computer Programming
14 Computer Systems Engineering – Second Semester
• The endl is one of the manipulator which changes the format of cout
statement.
• It brings the text on new line.
• It is used with in cout statement.
• The name endl is included in std namespace.
int main()
{
cout<<"14 Computer Systems"<<endl;
cout<<"MUET"<<endl;
cout<<"Jamshoro";
getch();
return 0;
}
Ali Asghar Manjotho, Lecturer CSE-MUET 4
endl Manipulator
Output on monitor screen
#include<iostream>
#include<conio.h>
int main()
{
cout<<"14 Computer Systems"<<endl<<"MUET"<<endl<<"Jamshoro";
getch();
return 0;
}
#include<iostream>
#include<conio.h>
int main()
{
std::cout<<"14 Computer Systems"<<std::endl;
std::cout<<"MUET"<<std::endl;
std::cout<<"Jamshoro";
getch();
return 0;
}
int main()
{
cout<<"14 Computer Systems\nMUET\nJamshoro";
getch();
return 0;
}
int main()
{
cout<<"14 Computer Systems\n";
cout<<"MUET\n";
cout<<"Jamshoro";
getch();
return 0;
}
Ali Asghar Manjotho, Lecturer CSE-MUET 12
Escape Sequence ( \n )
int main()
{
cout<<"14 Computer Systems\tMUET\tJamshoro";
getch();
return 0;
}
int main()
{
cout<<"\"14 Computer Systems\" \n";
cout<<"\'MUET\'\t \\Jamshoro";
getch();
return 0;
}
• Comment is the text that is used to explain the code inside the program.
• A comment is a line (or multiple lines) of text that are inserted into the source code
to explain what the code is doing.
• The programmer writes the comments in the program to make is easier to read for
other persons (who want to read it).
• The comments are always ignored (not executed) by the compiler.
• The comments are non-executable statements in the program.
• Compiler does not consider comments as part of the program.
• Comments are also helpful during debugging the program.
For Example:
getch(); //gets single character from the keyboard