100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS1511 Book Summary $4.74   Add to cart

Summary

COS1511 Book Summary

3 reviews
 257 views  21 purchases
  • Course
  • Institution

This document consists of a summary of the whole module for revision

Preview 2 out of 41  pages

  • July 23, 2019
  • 41
  • 2018/2019
  • Summary

3  reviews

review-writer-avatar

By: sibandensizwa • 3 year ago

review-writer-avatar

By: rasher • 4 year ago

review-writer-avatar

By: slindoh14 • 4 year ago

avatar-seller
Lesson 1 - Your first program
Friday, 03 March 2017 11:53 AM

General rule:
Always use << with cout.


Include <iostream>:
Special instruction that we always put at the top of the code to tell the compiler to include the
iostream header file. Header files basically define a number of additional instructions that we can
use in our programs to make them simpler and neater. A particularly useful one is iostream. The io in
iostream stands for Input/Output and this header file allows us to use the cout instruction to output
messages to the screen.


namespace std;
Some C++ compilers allow you to leave this out.


#include <iostream>
int main( )
{
std::cout << "Hello world";
return 0;
}


cout is defined in the iostream header file. All the names defined in it belong to a namespace called
std. If you don't use using namespace std; in your program, then you should prefix every name that
belongs to the std namespace with std::.


int main( )
This is the header for the main function of the program.


Semicolons:
Semicolon is called a statement terminator. Each statement must be terminated by a semicolon.


cout <<:
Stands for console output (display). Pronounce cout as “see-out”


Comment statement:
Is a text that we add to a program that has no effect on the running of the program but that is
generally used to explain what the programming (or part of the program) does.


//This is a comment statement



UNISA Page 1

, Endl:
Endl stands for end line. When used with cout it makes output continue on the next line.


C++ Structure:
//DescriptiveComment
#include <StandardHeaderFile>
using namespace std;

int main( )
{
StatementSequence;
}





UNISA Page 2

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Naz1611. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $4.74. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73091 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$4.74  21x  sold
  • (3)
  Add to cart