hello guys iwas trying to code a supermarket cpp progam throiugh dev cpp am stuck for three dyas now please help it kept on sayi | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 3

hello guys iwas trying to code a supermarket cpp progam throiugh dev cpp am stuck for three dyas now please help it kept on sayi

/*----------Super Market Billing-------------*/ /*Header File*/ #include<iostream> #include<conio.h> #include<string.h> #include<stdio.h> #include<process.h> #include<fstream> void gotoxy(short x, short y); using namespace std ; /*Class*/ class product { int pno; char name[50]; float price,qty,tax,dis; public: product() { pno=000; strcpy(name,"..."); price=000; qty=000; tax=000; dis=000; } void create_product() { cout<<"Please Enter The Product No.of The Product: "; cin>>pno; cout<<"\n\nPlease Enter The Name ofThe Product: "; gets(name); cout<<"\nPlease Enter The Price of The Product: "; cin>>price; cout<<"\nPlease Enter The Discount(%): "; cin>>dis; } void show_product() { cout<<"\nThe Product No. of The Product: "<<pno; cout<<"\nThe Name of The Product: "; puts(name); cout<<"\nThe Price of The Product:"<<price; cout<<"\nDiscount: "<<dis; } int retpno() { return pno; } float retprice() { return price; } char* retname() { return name; } int retdis() { return dis; } }; //class ends here /*Global declaration for stream object,object*/ fstream fp; product pr; /*Function to write in file*/ void write_product() { fp.open("Shop.dat",ios::out|ios::app); pr.create_product(); fp.write((char*)&pr,sizeof(product)); fp.close(); cout<<"\n\nThe Product Has Been Created "; getch(); } /*Function to read all records from file*/ void display_all() { system("cls"); cout<<"\n\n\n\t\tDISPLAY ALL RECORD!!!\n\n"; fp.open("Shop.dat",ios::in); while(fp.read((char*)&pr,sizeof(product))) { pr.show_product(); cout<<"\n\n=============================\n"; getch(); } fp.close(); getch(); } /*Function to read specific record from file*/ void display_sp(int n) { int flag=0; fp.open("Shop.dat",ios::in); while(fp.read((char*)&pr,sizeof(product))) { if(pr.retpno()==n) { system("cls"); pr.show_product(); flag=1; } } fp.close(); if(flag==0) cout<<"\n\nrecord not exist"; getch(); } /*Function to modify record of file*/ void modify_product()

25th Jan 2021, 3:05 PM
Geoffrey Muli
Geoffrey Muli - avatar
9 Answers
+ 9
Geoffrey Muli , please don't put such codes in the text area. put your code in playground and link it here. AND: please use a proper presentation of your code. nobody likes to read and help in this horrible code formating.
25th Jan 2021, 7:57 PM
Lothar
Lothar - avatar
+ 3
Lothar sorry am new to solo learn
25th Jan 2021, 9:45 PM
Geoffrey Muli
Geoffrey Muli - avatar
+ 2
Thanks guys for the effort you made I really do appreciate! I'll keep on trying till it meets my demands
26th Jan 2021, 9:52 AM
Geoffrey Muli
Geoffrey Muli - avatar
+ 2
Martin Taylor am using Dev c++ for compiling and it's has only a small mistake of which am yet to realize
26th Jan 2021, 9:54 AM
Geoffrey Muli
Geoffrey Muli - avatar
+ 2
Geoffrey Muli When you ask questions related to your code. Share your code bit. You can do so by selecting the (+) button and choosing insert code. https://code.sololearn.com/cRT8sOSnL8OW/?ref=app
26th Jan 2021, 10:43 AM
Chris Coder
Chris Coder - avatar
+ 2
You guys what you are saying am googling some of your words but am really grateful since am learning new vocabularies that I wasn't exposed to am really grateful for the effort I just started programming about 3 months ago and am learning really fast cause of the effort and energy you are giving out also " this code isn't my am just trying to convert it so that it can run in Dev C++ IDE" Am still on it though
26th Jan 2021, 2:27 PM
Geoffrey Muli
Geoffrey Muli - avatar
+ 2
Martin Taylor I'm not recommending it. The tutorial that he copied the code from recommended it. The code does not use modern standards so what other option does he have other than to use a compiler that is as old as the code that is provided. I've been reading these post and no one has actually gave the person a solution to their problem. All I see is a bunch of opinions and preferences.
26th Jan 2021, 3:14 PM
Chris Coder
Chris Coder - avatar
0
Martin Taylor so I should use?
25th Jan 2021, 9:46 PM
Geoffrey Muli
Geoffrey Muli - avatar
0
Simple answer this will not work sololearn compiler. It appears that you have copied this example http://www.cppforschool.com/project/super-market-billing.html You will need to install Turbo.C 3.2 to compile and run this code. You can download from here. https://developerinsider.co/download-turbo-c-for-windows-7-8-8-1-and-windows-10-32-64-bit-full-screen/
26th Jan 2021, 11:26 AM
Chris Coder
Chris Coder - avatar