questions

This is a discussion on questions within the C++ Programming forums, part of the General Programming Boards category; i want someone to help me with these questions please. 1- Write statement that assgn random integers to the variable ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    38

    Question questions

    i want someone to help me with these questions please.

    1- Write statement that assgn random integers to the variable n in the following range :
    -3<=n<=11 .

    2- Write a function multiple that determines for a pair of integers whether the second integer is a multiple of the first. The function should take two integer arguments and return 1 (true) if the second is multiple of the first, and 0 (false) otherwisw. Use this function in a program that inputs series of pairs of integers.

    3- Write a program that will help an elementary school student learn multiplication. Use rand to produce two positive one-digit integers. It should then type a question such as :

    How much is 6 times 7?

    The student then types the answer. Your program checks the student's answer. If it is correct, print "Very good!" and then ask another multiplication question. If the answer is wrong, print "No. Please try again." and then let the student try the same question again repeatedly until the student finally gets it right.

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Re: questions

    Originally posted by kuwait
    1- Write statement that assgn random integers to the variable n in the following range :
    -3<=n<=11 .
    (rand() % a) + b

    2- Write a function multiple that determines for a pair of integers whether the second integer is a multiple of the first. The function should take two integer arguments and return 1 (true) if the second is multiple of the first, and 0 (false) otherwisw. Use this function in a program that inputs series of pairs of integers.
    Modulus ( % ) returns the remainder of a division, helping you to know if a is a divider of b.
    12 % 3 = 0, since 12 = 4 * 3 + 0
    17 % 5 = 2, since 17 = 3 * 5 + 2

    3- Write a program that will help an elementary school student learn multiplication. Use rand to produce two positive one-digit integers. It should then type a question such as :

    How much is 6 times 7?

    The student then types the answer. Your program checks the student's answer. If it is correct, print "Very good!" and then ask another multiplication question. If the answer is wrong, print "No. Please try again." and then let the student try the same question again repeatedly until the student finally gets it right.
    Generate two random numbers, print them out formated as you showed, check if the user input equals the product of the numbers, then print answers according to that.
    Last edited by Magos; 11-19-2002 at 01:19 PM.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    First of all, we aren't automated homework-machines. Show us that you've done some work yourself, or at least thought it through, and if you're stuck, we'll help you. But we aren't going to your homework for you.

    And when you're stuck and ask for help, post the relevant code that you're stuck on.

    **EDIT**
    About us not being automated homework machines, Magos is an exception.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Originally posted by Hunter2
    **EDIT**
    About us not being automated homework machines, Magos is an exception.
    Naahh... didn't actually do the homework for him . Just explained how to do it. I left the coding for him.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Oh, sorry I didn't read your post carefully.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. questions....so many questions about random numbers....
    By face_master in forum C++ Programming
    Replies: 2
    Last Post: 07-30-2009, 09:47 AM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 06:36 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 08:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 08:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21