I am new to C++ and have a code that I need to fix. I am using C++ Visual Studio Express 2010. I am getting multiple errors and I am unsure of how to fix them Can someone help me fix this or show me how to do this correctly using Visual Studio express.
I am trying to write a program that accepts as input the bill for a meal at a restaurant, calculates the tax, the tip, and the total and then displays the amounts.
Calculate the tax using a tax rate of 7% (use a value of 0.07).
Calculate the tip using 18% (use a value of 0.18).
Your program should do the following:
1. Prompt the user for the amount of the meal.
2. Calculate the tax.
3. Calculate the tip.
4. Calculate the total.
5. Display the following values:
The amount on the bill for the meal
The amount you should pay for tax
The amount for the tip
The total amount you should pay (meal + tax + tip).
HINT: Use the data type double for these variables.
Below is the code I currently have
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double cost;
double tax;
double tip;
double total;
cout <<"please enter the cost of your meal: ";
cin >> cost;
tax = cost * 0.07;
tip = cost * 0.18;
total = cost + tax + tip;
cout << setprecision(2) << fixed;
cout <<"\n\nThe cost of your meal is: " << cost << "\n";
cout <<"\n\nThe tax amount is: " << tax << "\n";
cout <<"\n\nThe tip amount is: " << tip << "\n";
cout <<"\n\nThe total cost is: " << total << "\n";
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
|
The error says : 1>------ Build started: Project: proj, Configuration: Debug Win32 ------
1> proj.cpp
1>LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========