Jump to content

help!

- - - - -

  • Please log in to reply
5 replies to this topic

#1
zanje

zanje

    Newbie

  • Members
  • Pip
  • 2 posts
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!!

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Please, please, please post some code. I have no idea what you're talking about right now.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Flying Dutchman

Flying Dutchman

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 889 posts
  • Location:::1
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
alex1

alex1

    Learning Programmer

  • Members
  • PipPipPip
  • 93 posts

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
zanje

zanje

    Newbie

  • Members
  • Pip
  • 2 posts
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

#6
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,254 posts
  • Location:C:\Countries\US
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