Professional Documents
Culture Documents
Bruh I Hate File Handling - CPP
Bruh I Hate File Handling - CPP
h>
#include <conio.h>
#include <stdlib.h>
#include <string> //for string functions
#include <fstream> //for file handling
#include <iostream> // for file handling
//structure of seller
struct syapiAccountSeller{
char username[80];
int PIN[80];
char nameProduct[80][80];
int productPrice[80][80];
char buy[80];
};
struct syapiAccountSeller syapiSeller;
switch(choice){
case 1: {
system("cls");
printf("=== Syapi Seller Log In ===\n");
printf("Enter PIN: ");
scanf("%d", &syapiSeller.PIN[80]);
if (syapiSeller.PIN[80] == 123){
printf("\nLogin successful!\n");
printf("Welcome Syapi Seller!\n\n");
case 2: {
system("cls");
printf("These are the contents of your catalog:\n\n");
ifstream inFile ("products.txt");
while (!inFile.eof()) {
std::string output;
getline(inFile, output);
cout << output << endl;
}
cin.ignore();
printf("What will you buy?\n");
printf("Input: ");
gets(string);
printf("You bought:");
puts(string);
printf("\nThank you for shopping!");
getch();
break;
}
case 3: {
break;
}
default: {
printf("Wrong input. Please try again.");
getch();
break;
}
}
}
system("cls");
} while (choice !=3);