Can anyone help me to rectify this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone help me to rectify this code

#include<fstream> #include<iomanip> #include<windows.h> #include<conio.h> #include <ctype.h> #include<stdlib.h> #include<iostream> #include<cstring> #include<stdio.h> using namespace std; void WaitKey(); void gotoXY(int x, int y); HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE); COORD CursorPosition; static int a; string u_name; class bike { public:char rrn[2]; char bid[5]; char bname[15]; char borigin[10]; char bprice[10]; char bnumber[10]; }; class user { public:char uid[5]; char uname[15]; char upwd[15]; char uaddress[20]; char uphone[11]; }; fstream file1,file2,file3,file4,file5; void binsert() { string line; int count=0; char buffer[144]; file1.open("indexf.txt",ios::app); file2.open("bikes.txt",ios::in); system("cls"); cout<<" BIKE RENTAL SYSTEM \n"; if(!file2) { cout<<"\nWELCOME TO BIKE RENTAL SYSTEM"; } bike b; do { cout<<"\nBike name(15) : "; cin>>b.bname; }while(strlen(b.bname)>=15); do { cout<<"\n"<<"\tBike origin(10) : "; cin>>b.borigin; }while(strlen(b.borigin)>=10); do { cout<<"\n"<<"\tBike price(10) : "; cin>>b.bprice; }while(strlen(b.bprice)>=10); do { cout<<"\n"<<"\tBike number : "; cin>>b.bnumber; }while(strlen(b.bnumber)>10); while(getline(file2,line)) { count++; } file2.close(); file2.open("bikes.txt",ios::app); file3.open("index1.txt",ios::app); file2<<count+1<<"|"<<b.bname<<"|"<<b.borigin<<"|"<<b.bprice<<"|"<<b.bnumber<<"!"<<"\n"; file1<<b.bname<<"|"<<count+1<<"!"<<"\n"; file3<<b.bnumber<<"|"<<count+1<<"!"<<"\n"; file1.close(); file2.close(); file3.close(); cout<<"\n"<<"bike added successfully!!! : "; Sleep(500); } void bdelete() { string line; int count=0,i=0,found=99999,choice; char name[20],x[2]; file2.open("bikes.txt",ios::in); while(getline(file2,line)) { count++; } file2.close(); file2.open("bikes.txt",io

21st May 2021, 4:45 AM
Nayanth Singh
Nayanth Singh - avatar
6 Answers
+ 1
check for the errors bruh... just running the code for the first time won't work.
21st May 2021, 4:52 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
I am unable to run this code.
21st May 2021, 4:45 AM
Nayanth Singh
Nayanth Singh - avatar
0
The code is cut off. Save it in the code Playground and link it here. Also, atleast mention what error you're getting. I'm guessing the error is something like " 'conio.h' no such file or directory" And for that reason, please stop using <conio.h>. It is obsolete, and is not available anymore.
21st May 2021, 5:17 AM
XXX
XXX - avatar
0
./Playground/file0.cpp:3:9: fatal error: windows.h: No such file or directory 3 | #include<windows.h> | ^~~~~~~~~~~ compilation terminated. This is the error i am getting while running the code.
21st May 2021, 6:35 AM
Nayanth Singh
Nayanth Singh - avatar
0
Nayanth Singh That error is because the <windows.h> header file is not available in SoloLearn. It is found on windows systems only.
21st May 2021, 7:47 AM
XXX
XXX - avatar
21st May 2021, 9:50 AM
Nayanth Singh
Nayanth Singh - avatar