Thread: c begginers

  1. #1
    Registered User
    Join Date
    May 2007
    Posts
    1

    c begginers

    The condition is( if weight and distance are 10kg and 5 miles Rs 50. If the weight is more than 10kg ie per 1kg Rs 5 and after 5 miles 1 mile to 10 mile rs 10. After 15 mile for every mile Rs.20. kindly tell me the condition how to write it.

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Huh?

    And what's an Rs?
    If you understand what you're doing, you're not learning anything.

  3. #3
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Bleh. I'm not working on that condition now. I think I need sleep first or something. lol.

    What exactly do you need help with?

  4. #4
    Registered User
    Join Date
    May 2007
    Posts
    35
    >>The condition is( if weight and distance are 10kg and 5 miles Rs 50. If the >>weight is more than 10kg ie per 1kg Rs 5 and after 5 miles 1 mile to 10 mile >>rs 10. After 15 mile for every mile Rs.20. kindly tell me the condition how to >>write it.




    Code:
    int weight ,distance;,cnt;
    int cntdistance;//might not need this
    if (weight==10 &&distance==5){
                          Rs=50;
        }
    if(weight>10){
    cnt=weight-10;
    rs+=(5*cnt);
     
    }
    //assuming weight and distance are independent
    if(distance>5&&distance<=15){
    rs=10;
    }
     if(distance>15){
    cntdistance=distance-15;
    rs+=20*cntdistance;
     
    }

  5. #5
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    The condition is( if weight and distance are 10kg and 5 miles Rs 50. If the weight is more than 10kg ie per 1kg Rs 5 and after 5 miles 1 mile to 10 mile rs 10. After 15 mile for every mile Rs.20. kindly tell me the condition how to write it.
    Show us something that you've written, stop posting homework questions here..
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A begginer's question
    By santiman12 in forum C++ Programming
    Replies: 15
    Last Post: 07-14-2008, 08:40 AM
  2. begginers if statement problem
    By lastresort in forum C++ Programming
    Replies: 3
    Last Post: 01-31-2005, 04:56 PM
  3. extreme begginer's help
    By Rare177 in forum C# Programming
    Replies: 5
    Last Post: 05-31-2004, 08:22 AM
  4. Very, VERY Begginer's Question
    By Aki in forum C++ Programming
    Replies: 2
    Last Post: 11-25-2002, 04:17 PM