100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Otro

Review for UnsortedLists and SortedLists

Puntuación
-
Vendido
-
Páginas
5
Subido en
06-11-2025
Escrito en
2025/2026

The program is a quiz application designed to review concepts related to Unsorted Lists and Sorted Lists. It consists of multiple-choice questions and string input questions, with functionality to evaluate user responses and provide feedback. Key components include: - **Variables**: Used to track user input, correct answers, and scores. - **Functions**: - `checkCharAnswers` and `checkStringAnswers`: Validate single character and string answers. - `counting`: Updates the total score based on correctness. - `charMessage` and `stringMessage`: Provide feedback for individual answers. - `displayResult`: Summarizes the final score and performance. - `question1` through `question10`: Implement the quiz questions. The program guides users through the questions, collects answers, and displays results at the end, aiming to enhance understanding of the covered topics.

Mostrar más Leer menos
Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
6 de noviembre de 2025
Número de páginas
5
Escrito en
2025/2026
Tipo
Otro
Personaje
Desconocido

Temas

Vista previa del contenido

#include "UnsortedSorted.h"

int static counter = 0;
int static total = 0;
char input;
char answer;
string typedInput;
string typedAnswer;
bool correct;

bool checkCharAnswers(char input, char answer);
bool checkStringAnswers(string typedInput, string typedAnswer);
void counting(bool correct);
void charMessage(bool correct, char answer);
void stringMessage(bool correct, string typedAnswer);
void displayResult(int counter, int total);

void question1();
void question2();
void question3();
void question4();
void question5();
void question6();
void question7();
void question8();
void question9();
void question10();

int main()
{
cout << "WELCOME to the review for UnsortedLists and SortedLists" << endl;
cout << "If you find any errors or have any ideas to better improve my code,
please let me know. I might not have spent a million hours putting this together."
<< endl << endl;
cout << "NOTE: Be wary that by using strings to hold standard input, whitespace
is also taken into consideration when comparing answers. Always check the outputted
answer when the program claims your answer was 'wrong'" << endl << endl;
question1();
question2();
question3();
question4();
question5();
question6();
question7();

displayResult(counter, total);
}

void question1()
{
answer = 'A';

cout << endl <<
"--------------------------------------------------------------------" << endl;
cout << "When deleting an item in an unsorted list, what do you have to check
first?" << endl;
cout << "A. if the list is empty" << endl;
cout << "B. if the list is full" << endl;
cout << "C. if the user inputted numbers" << endl;

, cout << "D. if the user provided their name" << endl;

counter++;
cout << "Type the letter for your answer... ";
cin >> input;

correct = checkCharAnswers(input, answer);
counting(correct);
charMessage(correct, answer);
}

void question2()
{
typedAnswer = "midpoint = (first + last)/2;";
string typedAnswer2 = "midpoint = (last + first)/2;";

cout << endl <<
"--------------------------------------------------------------------" << endl;
cout << "Referring to the binary search discussed in lecture and homework,
there are three variables named: 'first', 'last', and 'midpoint'. Write the math
expression to calculate the midpoint." << endl;
cin.ignore();
cout << "Type your answer (don't forget the semicolon)... ";
getline(cin, typedInput);

counter++;
counting(correct);
if (checkStringAnswers(typedInput, typedAnswer) == true ||
checkStringAnswers(typedInput, typedAnswer2) == true)
{
cout << "Good job" << endl;
correct = true;
}
else
{
correct = false;
stringMessage(correct, typedAnswer);
cout << endl;
cout << "OR" << endl;
cout << endl;
stringMessage(correct, typedAnswer2);
}
}

void question3()
{
answer = 'B';

cout << endl <<
"--------------------------------------------------------------------" << endl;
cout << "What is the Big O for a binary search of a SortedList list?" << endl;
cout << "A. 0(1)" << endl;
cout << "B. 0(log n)" << endl;
cout << "C. 0(n)" << endl;
cout << "D. 0(ln n)" << endl;

counter++;
cout << "Type the letter for your answer... ";
cin >> input;
$25.49
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
tinahuynh

Conoce al vendedor

Seller avatar
tinahuynh California State University, Long Beach
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
Nuevo en Stuvia
Miembro desde
1 mes
Número de seguidores
0
Documentos
68
Última venta
-

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

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