473,382 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

to find and correct errors in this mini project

hi all



Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<fstream.h>
  3. using namespace  std;
  4. class supermarketsystem
  5. {
  6. int pronum,proprice,proquantity;
  7. char proname[30],protype[30];
  8. int salesnum,salesquantity,salesprice,totalcost;
  9. char salesdate,salesname;
  10. public:
  11. void set_inventory_module(void);
  12. void set_sales_module(void);
  13. void display_imdetails(void);
  14. void display_smdetails(void);
  15. };
  16.  
  17.  
  18.  
  19. void supermarketsystem::set_inventory_module(void)
  20. {
  21. cout<<"enter product number:";
  22. cin>>pronum;
  23. cout<<"\n enter product name:";
  24. cin>>proname;
  25. cout<<"\n enter product type(Grocery/dairy/cosmetics):";
  26. cin>>protype;
  27. cout<<"\n enter product price:";
  28. cin>>proprice;
  29. cout<<"\n enter product quantity:";
  30. cin>>proquantity;
  31. }
  32.  
  33.  
  34. void supermarketsystem::set_sales_module(void)
  35. {
  36. cout<<"enter the product date:";
  37. cin>>salesdate;
  38. cout<<"\n enter the product number:";
  39. cin>>salesnum;
  40. cout<<"\n enter the product name:";
  41. cin>>salesname;
  42. cout<<"\n enter the product quantity:";
  43. cin>>salesquantity;
  44. cout<<"\n enter the product price:";
  45. cin>>salesprice;
  46. cout<<"\nenter the total cost:";
  47. cin>>totalcost;
  48. }
  49.  
  50.  
  51. void supermarketsystem::display_imdetails(void)
  52. {
  53. cout<<"\n product number:"<<pronum;
  54. cout<<"\n product name:"<<proname;
  55. cout<<"\n product type:"<<protype;
  56. cout<<"\n product price:"<<proprice;
  57. cout<<"\n product quantity:"<<proquantity;
  58. }
  59.  
  60.  
  61. void supermarketsystem::display_smdetails(void)
  62. {
  63. cout<<"\n sale product date:"<<salesdate;
  64. cout<<"\n sale product number:"<<salesnum;
  65. cout<<"\n sale product name:"<<salesname;
  66. cout<<"\n sale product quantity:"<<salesquantity;
  67. cout<<"\n sale product price:"<<salesprice;
  68. cout<<"\n sale total cost:"<<totalcost;
  69. }
  70.  
  71. void user_inventorydetalis();
  72. void user_salesdetails();
  73. void read_inventorydetails();
  74. void read_salesdetails();
  75. int main()
  76. {
  77. int i;
  78. cout<<"select an option:\n 1.user details";
  79. cin>>i;
  80. switch(i)
  81.  {
  82. case 1:
  83.   {
  84.   user_inventorydetails();
  85.   }
  86. case 2:
  87.   {
  88.   user_salesdetails();
  89.   }
  90. case 3:
  91.   {
  92.   read_inventorydetails();
  93.   }
  94. case 4:
  95.   {
  96.   read_salesdetails();
  97.   }
  98. }
  99. return(0);
  100. }
  101. void user_inventorydetails()
  102. {
  103. supermarketsystem sms;
  104. ofstream outfile;
  105. outfile.open("sms.txt",ios::out|ios::app);
  106. sms.set_inventory_module();
  107. outfile.write(reinterpret_cast<char*>(&sms),sizeof(supermarketsystem));
  108. outfile.close();
  109. }
  110. void user_salesdetails()
  111. {
  112. supermarketsystem sms;
  113. ofstream outfiles;
  114. outfile.open("sms.txt",ios::out|ios::app);
  115. sms.set_sales_module();
  116. outfile.write(reinterpret_cast<char*>(&sms),sizeof(supermarketsystem));
  117. outfile.close();
  118. }
  119. void read_inventorydetails()
  120. {
  121. supermarketsystem sms;
  122. ifstream infile;
  123. infile.open("sms.txt",ios::binary);
  124. if(!infile)
  125.  {
  126.  cout<<"file not exist, press any key";
  127.  return;
  128.  }
  129. while(infile.read(reinterpret_cast<char*> (&sms),sizeof(supermarketsystem))
  130.  {
  131. sms.display_imdetails();
  132.  }
  133. }
  134. void read_salesdetails()
  135. {
  136. supermarketsystem sms;
  137. ifstream infile;
  138. infile.open("sms.txt",ios::binary);
  139. if(!infile)
  140.  {
  141.  cout<<"file not exist, press any key";
  142.  return;
  143.  }
  144. while(infile.read(renterpret_cast<char*>(&sms),sizeof(supermarketsystem))
  145.  {
  146. sms.display_smdetails();
  147.  }
  148. }
  149.  
this code is have 14 errors, I can't find and correct the errors so help me to correct it, it is not completed
Apr 29 '13 #1
1 1042
weaknessforcats
9,208 Expert Mod 8TB
You haven't posted the errors so it's kinda hard to see what the problem is.

Generally, you fix the first error and re-compile since the other errors may be cuased by the first one.

Your error will have the file name and line number of the error. That is where the compiler knew it was in trouble. The real error will be there or any place earlier in the file.
Apr 29 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

41
by: Michael Strorm | last post by:
Hi, I'm in the middle of "teaching" myself C++. Having skimmed some of the "Teach Yourself C++ in 21 Days" book, I got a feel for the language, at least. Then I bought "The C++ Programming...
1
by: Dr. Zharkov | last post by:
Hello. A problem in the following. In VB .NET 2003 I create the project and in file Form1.vb is written down the following code: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As...
3
by: alpa shah | last post by:
Hi, please suggest me Mini project topic in ASP language....
0
by: greatsee | last post by:
Find tickets from this list: http://allticket.yourfreewebspace.com/
7
by: pangsans | last post by:
hai i wud like to do a mini project with two of my friends in c or c++.i jus cant decide on a suitable one.it wud n very very helpful if u guys cud suggest some topics
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
10
by: spacebebop | last post by:
#include <cstring> #include <iostream> using namespace std; class X { public: X(); X( char * ); ~X();
0
by: priyanan | last post by:
suggest me a new mini project in asp.net which is easy to understand and well to do
11
by: smt | last post by:
hai, plz any body give simple topic of doing a mini project in C
4
by: Pankaj S | last post by:
Hi! I have just joined this group. I want just a mini project in c/c++ on any topic so that it is not so much easy and not so much complicated. It should be just looking like a engineering...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.