Question

PLEASE DO NOT COPY AND PASTE FROM A PREVIOUS QUESTION , THIS IS DIFFERENT. PLEASE READ STEP 5 CAREFULLY.

MUST BE WRITTEN IN C++

You are to implement a program for creating a daily transaction ledger for a shop. For this project, you will need to utilize

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream.h>
#include<String.h>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>

//using namespace std;

void main()
{
   int id[10], counter=0, temp, flag;
   double cp[10], sp[10], profit[10];
   char name[10][20];
   char choice, choice1;
   clrscr();
   cout<<"\nadd? (y/n)"<<endl;       //add new
   cin>>choice;
while(choice!='n')
{

   flag=0;
   if(counter == 9)
       cout<<"\nFULL!";
   else
   {
       l:temp=rand();           //random func
       for(int i=0; i<counter-1; i++)
       {
           if(temp==id[i])
               flag=1;
       }
       if (flag==1)
           goto l;           //if value is repeated
       else
           id[counter]=temp;
       cout<<"\nEnter name, cp, sp\n";       //details
       gets(name[counter]);
       cin>>cp[counter];
       cin>>sp[counter];
       profit[counter]=sp[counter]-cp[counter];
       counter++;
   }

   cout<<"\nadd? (y/n)"<<endl;
   cin>>choice;
}

   cout<<"\ndelete? (y/n)"<<endl;       //delete
   cin>>choice1;
while(choice1!='n')
{
   flag=0;
   if(counter == 0)
       cout<<"\nEMPTY!";       //check for empty
   else
   {
       cout<<"\nEnter record number:\t";
       cin>>temp;

       for (int i=temp; i<9   ; i++)       //removing entry
       {
           strcpy(name[i],name[i+1]);
           id[i]=id[i+1];
           cp[i]=cp[i+1];
           sp[i]=sp[i+1];
           profit[i]=profit[i+1];
       }
       counter--;
   }

   cout<<"\ndelete? (y/n)"<<endl;
   cin>>choice1;
}


for (int i=0; i<counter; i++)
cout<<"\nSummary:\n"<<id[i]<<endl<<name[i]<<"\n"<<cp[i]<<endl<<sp[i]<<endl<<profit[i];
}

FLIl t2 34 add? (y/m) delete? (y/n) Enter record mumber: 0 delete? (y/m) Summary: 130 t2 9 34 25

COMMENT DOWN FOR ANY QUERIES AND,

LEAVE A THUMBS UP IF THIS ANSWER HELPS YOU.

Add a comment
Know the answer?
Add Answer to:
PLEASE DO NOT COPY AND PASTE FROM A PREVIOUS QUESTION , THIS IS DIFFERENT. PLEASE READ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create a program using C++ for a store. It will be a ledger for daily transactions....

    Create a program using C++ for a store. It will be a ledger for daily transactions. It should be able to record the transactions on a date. The transactions will happen at a given time (hour, minute, second). Also, every transaction must have a unique ID that is a number that is randomly generated by the system. *Note that the transaction has an ID, NOT the items. There will be no more than 10 transactions on a date. Within every...

  • (Please do not copy and paste from another question. I am new to this and need...

    (Please do not copy and paste from another question. I am new to this and need it to be simple) Draw an ERD for a “Hospital” with many departments and employees in each department. show things like (one to one, one to many, many to many). What attributes would you store regarding each objects/class/data entities? Thank you! (Example) FIGURE 4-10 An ERD for a bank with many branches Customer cust number-PK name bill address home phone office phone = Account...

  • I need new and unique answers, please. (Use your own words, don't copy and paste), Please...

    I need new and unique answers, please. (Use your own words, don't copy and paste), Please Use your keyboard (Don't use handwriting) Thank you.. Question 1- The trial balance of Makkah Inc: Credit Debit 15,000 Account title Cash Account payable Retained earnings Total 10,000 5,000 15,000 15,000 Makkah, Inc., completed the following transactions during April 2016: a. Received $18,200 and issued ordinary shares. b. Purchased $200 office supplies on account. C. Paid $15,200 cash for land to use as a...

  • Please copy and paste your Excel bond calculations under each relevant question. Do NOT submit an...

    Please copy and paste your Excel bond calculations under each relevant question. Do NOT submit an Excel spreadsheet, only your word document with your name on it. A) A 30-year Treasury bond expiring on February 15, 2048 with a 3% coupon has a yield of 5%. Calculate its price. Assume the bond’s settlement date is June 30th, 2018. B) You want to buy a bond that pays an annual coupon of 4.2% on March 31st of each year. On June...

  • Project 4: ER-Diagram and DBDL (25 Points) Database Design Language (DBDL) Use Visio or Word to...

    Project 4: ER-Diagram and DBDL (25 Points) Database Design Language (DBDL) Use Visio or Word to create the model. The correct syntax must be used. Remember to list out all alternate keys, secondary keys, and foreign keys. Entity Relationship Diagram (ERD) Draw the data model for the situation using LucidChart, Microsoft Visio, Word or other ERD Drawing Program. When drawing the objects, be sure to use the correct shapes, and syntax. Example: Entity is a rectangle box, and the name...

  • Prepare a project charter for PushForHelp’s Virtual Contact Center. Please do not copy and paste and...

    Prepare a project charter for PushForHelp’s Virtual Contact Center. Please do not copy and paste and use the template bellow. PUSH FOR HELP VIRTUAL CALL CENTER PROJECT Phase 1: Initiating Scenario The Information Age changes our perception of time and customer service. Customers now expect, and often receive instantaneous satisfaction at all times – in the home, at work and on the road. Just as the internet and ebusiness have transformed expectations in the home and at work, customers are...

  • read this three article and do a essay 1. Please follow the format Paragraph 1: Introduction...

    read this three article and do a essay 1. Please follow the format Paragraph 1: Introduction Paragraph 2: Annotations for article 1 Paragraph 3: Annotations for article 2 Paragraph 4: Annotations for article 3 Paragraph 5: Conclusion 2. For the introduction, you are required to discuss briefly what online focus groups are, followed by the reasons for the selection of the 3 articles, and then provide a one sentence summary for each of the article. 3. For the annotations (paragraph...

  • Pleasw answer 1-3. Do not cooy and paste from another edition please CASE 5-2 Cyclone Transportation...

    Pleasw answer 1-3. Do not cooy and paste from another edition please CASE 5-2 Cyclone Transportation Cyclone Transportation is a medium-sized truckload carrier based in Ohio, United States. You are a procurement manager of this company, whose main responsibility is the procure- ment of diesel fuel for the company's fleet of Class 8 trucks. You have been assigned to negotiate the fuel contract for the Perrysburg, Ohio market. Your assistant has collected the following per gallon information concerning the major...

  • Please read the sample runs carefully as this is quite different from the previous projects. In t...

    C Programming Please read the sample runs carefully as this is quite different from the previous projects. In this project, the student can take as many courses as permitted. The list of courses to take are listed below. This time there is no restriction on the total credit hours Your code should allow the user, after you enter the student' s id, to do the following options: 1- Add a course for the student 2- Drop a course for the...

  • Please provide a SQL Table diagram with their relationships based on the following prompt: Consider the...

    Please provide a SQL Table diagram with their relationships based on the following prompt: Consider the design of a database for an online store. Each item is identified by a unique item ID, a title, a description of the item, the date the item is posted, price, and a list of categories (each category is a single word in lower cases). Only registered users can post, buy, and review an item. Each registered user is identified by a user ID,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT