can anybody help i know it was basic but im little bit confusing on how I will put a word on asign value
like when I will write "1" then when I enter it will change to "Right"??
pleasee!!
5 replies to this topic
#1
Posted 16 December 2011 - 04:01 AM
|
|
|
#2
Posted 16 December 2011 - 06:29 AM
Please, please, please post some code. I have no idea what you're talking about right now.
#3
Posted 16 December 2011 - 08:02 AM
var = get_user_input
if var equals '1'
print "Right"
Did you mean something like this?
A conclusion is where you got tired of thinking.
#define class struct // All is public.
#4
Posted 16 December 2011 - 10:50 AM
int i;
printf("enter a number: ");
scanf("%d",&i);
if(i==1){
printf("\nRight");
}
It's simmilar to Flying Dutchman's code.Is this what you asked for? :)
#5
Posted 16 December 2011 - 03:11 PM
thanks for your help..
I try it in my input int. and its work..is there a way to do this on a randomizer?because when i put the code on randomizer the state are also rambling
I try it in my input int. and its work..is there a way to do this on a randomizer?because when i put the code on randomizer the state are also rambling
#6
Posted 16 December 2011 - 03:29 PM
I don't know what you mean by 'randomizer' , but I do have an idea for the original question. You could probably have an array of "questions" (for example, '1'), and an array of the corresponding "answers" (for example, 'Right'). Then you could scan the questions array for the entered word and index the answer array for the corresponding answer. For example, like for a dictionary, you could do something like:
var questions= ["my", "your", "apple", "banana", "answer"];
var answers= ["belonging to me", "belonging to you", "a fruit", "another fruit, usually yellow in color", "a response to a question"];
var i;
var input= prompt ("Please enter a word:");
var output;
for (i in questions) if (questions[i] == input) alert (output= "The definition is: " + answers[i]);
if (!output) alert ("No definition found; sorry.");
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









