Thread: C++ Help..i'm stuck in the middle...

  1. #1
    Registered User
    Join Date
    Sep 2005

    C++ Help..i'm stuck in the middle...

    Help me the following C++ question:

    Write a program to help a local bookshop automate its billing system. The program should do the following:

    (a)Let the user enter the ISBN, the system will trace the title and price of the book automatically. The system should check whether the book is in the stock or not. If it is not, please let the user to enter again.
    (b)Allow a customer to buy more than one item from the bookshop.
    (c)Calculate and print the bill. The billing amount should include 5% tax.

    Sample Output:

    Welcome to Billy’BookShop

    Please enter the ISBN: 0128
    The title is C++ How to Program
    The Price is RM 108.90

    Do you wish to continue? y/n

    Please enter the ISBN: 0992
    The title is Introduction to Java Programming
    The Price is RM 89.60

    Do you wish to continue? y/n

    Your Receipt:

    0128 RM 108.90
    0992 RM 89.60
    Total RM 198.50
    Tax RM 9.92

    Total RM 208.42

    THANK YOU!!!

    p/s: I would thanks for who solve this problems..i appreciate ur help..
    Below...r some coding i hv done..not completed
    hope some 1 will help me complete

    Source Code<not Complete>
    #include <iostream.h> 
    struct bookshop 
    int ISDN; 
    char title; 
    int price; 
    void printbook (bookshop book); 
    int main() 
    float amount, rate; 
    int year; 
    cout <<"Please enter the amount: "; 
    cin >> amount; 
    cout <<"Please enter the number of years to invest: "; 
    cin >> year; 
    cout <<"Please enter the interest rate per year: "; 
    cin >> rate; 
    for (int y=0;y<year;y++) 
    amount = amount + (amount*rate/100); 
    cout <<"The amount you have "<<year<< "year is:" 
    << amount<<endl; 
    return 0; 

  2. #2
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    I didn't think we were here to complete your work. But if you have a problem with a certain part that would make sense, ie. you say "I dont know how to access the struct I created", "I'm not sure how to get it to ask if it wants to buy more books and quit on n"

    #include <iostream> 
    #include <cstdlib> //use these headers
    struct bookshop 
      int ISDN; 
      char title; 
      int price; 
    void printbook (bookshop book); 
    int main() 
    char continue = 'y'; 
    bookshop book[20]; //max 20
    int totalPrice = 0;
    int index = 0;
    while (continue == 'y') {
      cout <<"ISDN: "; 
      cin >> book[index].ISDN; 
      cout <<"Title: "; 
      cin >> book[index].title; 
      cout <<"Do you want to continue: "; 
      cin >> continue; 
      totalPrice = totalPrice + book[index].price;
    // do the reciept part here
    return 0; 
    I did a little more than I meant to do, but I'm not works either I also changed the headers, cstdlib and iostream (without .h) are the C++ versions, and are standard (updated, won't become deprecated in near future).
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stuck With C Assignment
    By adj123 in forum C Programming
    Replies: 1
    Last Post: 03-04-2008, 07:14 AM
  2. Replies: 6
    Last Post: 10-23-2006, 07:22 PM
  3. the definition of a mathematical "average" or "mean"
    By DavidP in forum A Brief History of
    Replies: 7
    Last Post: 12-03-2002, 11:15 AM
  4. Binary searches
    By Prezo in forum C Programming
    Replies: 4
    Last Post: 09-10-2002, 09:54 PM
  5. trying to sort a middle value
    By Led Zeppelin in forum C Programming
    Replies: 0
    Last Post: 04-27-2002, 12:05 PM