Thread: Thinking About Programming - A Guide for Beginners ?!?!? little problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    beginner for now
    Join Date
    Oct 2009
    Posts
    35

    Question Thinking About Programming - A Guide for Beginners ?!?!? little problem

    well the Thinking About Programming - A Guide for Beginners
    I gain trough mail I try it out

    well I could do alone all except to break the program if
    Code:
    (video1 && video2) < 1
    or something like that

    well problem occurs with days

    I gave that lot if cuz if 1 day cannot be 1 days

    so that if you say 1 day it musnt come out 1 days

    and when I try to put in
    Code:
    (video1 && video2) < 1
    it's problem cuz it doesn't look at all other if-s

    how could I repair this problem???
    I'm out of ideas

    Code:
    #include <iostream>
    using namespace std;
    
    int main ()
    
    
    
    {
        int x;
        int y;
        int video1;
        int video2;
        cout << "we have 2 available videos to rent\n\n";
        cout << "1 - yes\n_____________________\n1. video costs 2.00$ |\n";
        cout << "2. video costs 3.00$ |\n";
        cout << "_____________________|\n";
        cout << "\n\n\n\n2 - no\n_____________________\nexit                 |\n";
        cout << "_____________________|\n\n\n\n\n";
        cout << "would you like to rent any of videos?\n";
        cin >> x;
        if (x == 2)
              {cout <<"good bye\n";}
        
        else if (x == 1)
             {
                   cout << "\n\nwould you like to rent video1?\n";
                   cout << "this video costs 2.00 $\n";
                   cout << "for how many days would you like to rent video 1\n";
                   cin >> video1;
                   
                   cout << "\n\nwould you like to rent video 2?\n";
                   cout << "this video costs 3.00$";
                   cout << "for how many days would you like to rent video 2\n";
                   cin >> video2;
                   
                   if (video1 > 1)
                   {cout << "\n\n\nvideo 1 is rented for: "<< video1 <<" days\n";}
                   else if (video1 == 1)
                   {cout << "\n\n\nvideo 1 is rented for: "<< video1 <<" day\n";}
                   else
                   {cout << "\n\n\nvideo 1 is not rented\n";}
                   
                   if (video2 > 1)
                   {cout << "video 2 is rented for: "<< video2 <<" days\n\n";}
                   else if (video2 == 1)
                   {cout << "video 2 is rented for: "<< video2 <<" day\n\n";}
                   else
                   {cout << "video 2 is not rented\n";}
    
                   
                   cout << "total cost of video 1 is: " << video1*2.00 << "$\ntotal cost of video 2 is: " << video2*3.00 << "$\n\n";
                   cout << "total cost is: " << video1*2.00 + video2*3.00 <<"$\n";
             }
        system ("pause");
        return 0;
    }
    Last edited by military genius; 10-05-2009 at 12:27 PM. Reason: I did wrong < 0 edit: --> < 1

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  5. Fluid Thinking
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 27
    Last Post: 11-20-2002, 03:29 PM