Thread: Help with math tables

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

    Help with math tables

    Hi guys,

    I have a project at college to write a program that will produce a mathamatics table, for example: -

    user will input the times table number ie, 5

    and also the user will input the amount of lines, ie 3,

    so the result will be: -

    1 x 5 = 5
    2 x 5 = 10
    3 x 5 = 15

    I dont want you to write the program for me, but some pointers of what to do would be most helpfull....

    Maybe a tutorial or something...

    Thanks alot guys

    Boontune

  2. #2
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    Well you're definately going to need a loop, probaly one that might look something like this:

    for(x=0;x<=number_of_lines;x++)

    I hope that helps you get started, if not say so.
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    59
    Cheers for getting back to me,

    would x be the times table number or would i assign the
    times table number to x?

  4. #4
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    No you'd need to have another variable with the number who's times table you want. Remeber this though, every time you go through the loop x will increase by one so if it's 3 times and I used this loop it would look like this:

    Code:
    int numberOfLines = 5
    int x;
    int number;
    
    
    for(x=0;i<=numberOfLines;x++)
    {
        cout << x;
    }
    would output this:

    0
    1
    2
    3
    4
    5


    Now, what do yo uwant to do with that?
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    59
    Yippeeeee, got it!

    Cant thank you enough mate!

    its been driving me mad for ages

    Cheers

    Boontune

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Math
    By knightjp in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 04-01-2009, 05:36 PM
  2. Help with C++ Math
    By aonic in forum C++ Programming
    Replies: 4
    Last Post: 01-29-2005, 04:40 AM
  3. Basic Math Problem. Undefined Math Functions
    By gsoft in forum C Programming
    Replies: 1
    Last Post: 12-28-2004, 03:14 AM
  4. Math Header?
    By Rune Hunter in forum C++ Programming
    Replies: 26
    Last Post: 09-17-2004, 06:39 AM
  5. toughest math course
    By axon in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 10-28-2003, 10:06 PM