• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 2 fuera de 11 páginas
Resumen

COS132 Chapter 2 summary

Document preview thumbnail
Vista previa 2 fuera de 11 páginas

Summary study book Starting Out with C++ of Tony Gaddis - ISBN: 9780132926867 (Detailed summary)

Vista previa del contenido

COS 132 Chapter 2



COS 132
CHAPTER 2 – INTRO TO C++
UNTI 2.1- THE PARTS OF A C++ PROGRAM




Line 2 #include <iostream>

Because this line starts w #, it is called a preprocessor directive. The preprocessor directive reads your program before it
is compiled and only executes those lines beginning w the symbol.

The #include directive causes the preprocessor to include the contents of another file (header file) in the program. It is
called the header file bc it should be included in the head of the program. <iostream> is the name of the header file that
is to be included.

Line 3 using namespace std;

This statement declares that the program will be accessing entities whose names are part of the namespace called std.

Line 5 int main()

This marks the beginning of a function, a function can be thought of as a group of one or more programming statements
that collectively has a name.

Line 7 cout << “Programming is great fun!”;

The group of characters inside the quotation marks is called a string lateral or string constant.

Line 8 return 0;




1|P a g e

, COS 132 Chapter 2

This sends the in value 0 back to the operating system upon the programs completion, the value indicates that a
program executed successfully.




UNIT 2.2 – THE COUT OBJECT

This is the simplest type of screen output that a program can display – console output which is just plain text.

Cout is classified as a stream object, which means it works w streams of data. To print a message on the screen, you
send a stream of characters to cout. When << operator is used in this way, it is called the stream insertion operator.
Think of it as an arrow that must point towards cout.

There are two ways to instruct cout to start a new line.

1. Send cout a stream manipulator called endl
- cout << “text” << endl;
2. Insert an escape sequence in the string itself, this starts w “\” and is follows by a control character
- cout << “text\n”;
- When using escape sequences, do not put a space between the backslash and the control character.




2|P a g e

Libro relacionado
 image
Tony Gaddis Starting Out with C++
Editorial: Desconocido ISBN: 9780132926867 Edición: Desconocido

Información del documento

¿Un libro?
Sí
Subido en
20 de abril de 2022
Número de páginas
11
Escrito en
2021/2022
Tipo
Resumen
$5.21

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
jennamortonx
3.5
(2)
Vendido
30
Seguidores
1
Artículos
74
Última venta
1 mes hace




Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes