Question
what is the error with this C++ code please #include #include #include using namespace std; // Global Variables string inv_no; string inv_date; string cust_name; string
what is the error with this C++ code please
#include
using namespace std;
// Global Variables string inv_no; string inv_date; string cust_name; string cust_address; float total_amt; float tax_amt; float discount; float advance;
// Function Definitions void main_menu(); void new_invoice(); void new_company(); void new_customer(); void new_order(); void get_item(); void update(); void print(); void printInv();
class Invoice { public: // New Invoice void new_invoice() { // Input invoice number, date and customer name cout << "Enter invoice number: "; cin >> inv_no; cout << "Enter invoice date: "; cin >> inv_date; cout << "Enter customer name: "; cin >> cust_name;
// Open file ofstream inv_file; inv_file.open("Invoice.txt", ios::out | ios::app);
// Write to file inv_file << inv_no << " " << inv_date << " " << cust_name << endl;
// Close file inv_file.close(); }
// Print Invoice void print() { // Open file ifstream inv_file; inv_file.open("Invoice.txt");
// Read and display file contents cout << "Invoice details:" << endl; while (inv_file >> inv_no >> inv_date >> cust_name) { cout << inv_no << " " << inv_date << " " << cust_name << endl; }
// Close file inv_file.close(); }
// New Company void new_company() { // Input company name, address and layout string comp_name; string comp_address; string layout; cout << "Enter company name: "; cin >> comp_name; cout << "Enter company address: "; cin >> comp_address; cout << "Enter invoice layout: "; cin >> layout;
// Open file ofstream comp_file; comp_file.open("Company.txt", ios::out | ios::app);
// Write to file comp_file << comp_name << " " << comp_address << " " << layout << endl;
// Close file comp_file.close(); }
// New Customer void new_customer() { // Input customer name, address and contact number string cust_name; string cust_address; string contact_no; cout << "Enter customer name: "; cin >> cust_name; cout << "Enter customer address: "; cin >> cust_address; cout << "Enter customer contact number: "; cin >> contact_no;
// Open file ofstream cust_file; cust_file.open("Customers.txt", ios::out | ios::app);
// Write to file cust_file << cust_name << " " << cust_address << " " << contact_no << endl;
// Close file cust_file.close(); }
// New Order void new_order() { // Input order details string order_no; string order_date; string item; float quantity; float unit_price; cout << "Enter order number: "; cin >> order_no; cout << "Enter order date: "; cin >> order_date; cout << "Enter item: "; cin >> item; cout << "Enter quantity: "; cin >> quantity; cout << "Enter unit price: "; cin >> unit_price;
// Open file ofstream order_file; order_file.open("Orders.txt", ios::out | ios::app);
// Write to file order_file << order_no << " " << order_date << " " << item << " " << quantity << " " << unit_price << endl;
// Close file order_file.close(); }
// Get Item void get_item() { // Input item details string item_no; string item_name; float quantity; float unit_price; cout << "Enter item number: "; cin >> item_no; cout << "Enter item name: "; cin >> item_name; cout << "Enter quantity: "; cin >> quantity; cout << "Enter unit price: "; cin >> unit_price;
// Open file ofstream item_file; item_file.open("Items.txt", ios::out | ios::app);
// Write to file item_file << item_no << " " << item_name << " " << quantity << " " << unit_price << endl;
// Close file item_file.close(); }
// Update Invoice void update() { // Input invoice details float total_amt; float tax_amt; float discount; float advance; cout << "Enter total amount: "; cin >> total_amt; cout << "Enter tax amount: "; cin >> tax_amt; cout << "Enter discount: "; cin >> discount; cout << "Enter advance: "; cin >> advance;
// Open file ofstream inv_file; inv_file.open("Invoice.txt", ios::out | ios::app);
// Write to file inv_file << total_amt << " " << tax_amt << " " << discount << " " << advance << endl;
// Close file inv_file.close(); } int main()
{
//Main Menu
void main_menu();
return 0;
} // Print Invoice void printInv() { cout << "Invoice Number: " << inv_no << endl; cout << "Invoice Date: " << inv_date << endl; cout << "Customer Name: " << cust_name << endl; cout << "Customer Address: " << cust_address << endl; cout << "Total Amount: " << total_amt << endl; cout << "Tax Amount: " << tax_amt << endl; cout << "Discount: " << discount << endl; } };
******************************************
this is error one undefined reference to `WinMain'
error 2 ld returned 1 exit status
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started