Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to randomize the order of these questions. Two versions. One with if then else and one with switch-case. No arrays. Use any loop

I need to randomize the order of these questions. Two versions. One with if then else and one with switch-case. No arrays. Use any loop you like.
Hints:

use srand ( ) and rand ( ) functions.

Use Mod operator to get a random number from 1 to 5

use five variables to flag if a question is repeated or not.

Thank you!

image text in transcribed
#include int main() { unsigned char score - 0; unsigned char answer: printf ("Enter 1, 2, 3 or 4 "); printf ("The neighbors of USA are "); printf ("1. Canada and Mexico "); printf i "2. United Kingdom, Russia, Mexico and North Carolina "); printf ( 3. Brazii, Mexico, Canada "); printf ("4. No Neighbors "); scant ("hu", &answer): if ( answer == 1) score++; printf ("What is USA stands forin"); printf("1. United States of America "); printf ("2. United Stand Always "); printf ("3. United South Africain"); printf ("4. United State Employees in); scant ("hu". Lanswer); if ( answer!) score++; printf ("Where is USA "); printf("1. Above Canada "); printf("2. Below Canada "); printf ("3. Below Mexico "); printf ("4. Next to Texas "); scant ("hu". Lanswer); if ( answer - 2) score++; printf ("Where is Canada "); printf("1. Below USA "); printf("2. Next to Australia "); printf ("3. Below Mexico "); printf("4. Above USA "); scanf("hu", sanswer): if (answer - 4 > score++; printf("Where is California "); printf("1. Next to Nevada "); printf("2. Next to Texas "); printf ("3. Next to Washington DC "); printf (1.14. Next to Washington State "); scant ("hu", sanswer): if ( answer == 1) score++; printf ("Thank you for completing the Quiz. Your scored ", score ) return 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions

Question

=+3. Who can provide information for evaluation?

Answered: 1 week ago

Question

Refer to Problem 10-1. What is the projects PI?

Answered: 1 week ago

Question

Azure Analytics is a suite made up of which three tools?

Answered: 1 week ago

Question

3. Is IBMs program really a mentoring program? Why or why not?

Answered: 1 week ago