Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C, if you a user has the option of entering an integer and a char at any time he wants...what data type should I

In C, if you a user has the option of entering an integer and a char at any time he wants...what data type should I use take the input from the user?

Example: Suppose I have the following table...

State State0 State1
A B C
B A C
C C A

Starting state :A

When the program starts...it displays "A"...the user has the option of entering 0,1 or c or d.

If the state is at A and the user enters "0" then the state changes to B and the program displays "B". After that if the user enter 1 then it goes to C and prints out "C".

My question is that the user has the option of pressing 'c' at any time. The character 'c' is followed by a `1' or a `0' followed by the name of a state (i.e. a single letter in the range AC). This command modifies the state machine such that the `0' (or `1') command applied to the current state will cause the machine to change to the named state and that this change is the state machine configuration will continue. This command should produce no output

How would I read the input from the user when the user has the option of entering int or char at any time?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions