• ¿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 7 páginas
Examen

Chapter 6 C++

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

Exam of 7 pages for the course Chapter 6 C++ at Chapter 6 C++ (Chapter 6 C++)

Vista previa del contenido

Chapter 6 C++ GRADE A QUESTIONS WITH
SOLUTIONS
printTodaysDate is a function that accepts no parameters and returns no value.



Write a statement that calls printTodaysDate. - (correct answer)printTodaysDate();



Write the definition of a function printDottedLine, which has no parameters and doesn't
return anything. The function prints to standard output a single line (terminated by a new
line character) consisting of 5 periods. - (correct answer)void printDottedLine()

{

cout << ".....\n";

}


Write a statement that declares a prototype for a function printTodaysDate, which has
no parameters and doesn't return anything. - (correct answer)void printTodaysDate();



printErrorDescription is a function that accepts one int parameter and returns no value.



Write a statement that calls the function printErrorDescription, passing it the value 14. -
(correct answer)printErrorDescription(14);


printLarger is a function that accepts two int parameters and returns no value.



Two int variables, sales1 and sales2, have already been declared and initialized.



Write a statement that calls printLarger, passing it sales1 and sales2. - (correct
answer)printLarger(sales1, sales2);

, Write a statement that declares a prototype for a function printErrorDescription, which
has an int parameter and returns nothing. - (correct answer)void
printErrorDescription(int);



Write a statement that declares a prototype for a function printLarger, which has two int
parameters and returns no value. - (correct answer)void printLarger(int,int);



Write the definition of a function printGrade, which has a char parameter and returns
nothing. The function prints on a line by itself the message string Grade: followed by the
char parameter (printed as a character) to standard output. Don't forget to put a new line
character at the end of your line.



Thus, if the value of the parameter is 'A', the function prints out Grade: A - (correct
answer)void printGrade(char grade)

{

cout << "Grade: " << grade << "\n";

}



Write the definition of a function printAttitude, which has an int parameter and returns
nothing. The function prints a message to standard output depending on the value of its
parameter.



If the parameter equals 1, the function prints disagree
If the parameter equals 2, the function prints no opinion

If the parameter equals 3, the function prints agree

In the case of other values, the function does nothing.



Each message is printed on a line by itself. - (correct answer)void printAttitude(int input)

{

switch(input)

Información del documento

Subido en
26 de octubre de 2024
Número de páginas
7
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$10.49

¿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
douglasmugwe82
5.0
(1)
Vendido
2
Seguidores
0
Artículos
4215
Última venta
1 año 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