unsolved externals error

Can someone take a look at this and give me an idea of what I need to fix? Thanks




#include <iostream>
using namespace std;

int main()
{
//Receive amount
cout << " Enter an amount in double: ";
double amount;
cin >> amount;

int remainingAmount = static_cast<int>(amount * 100);

//Find dollar amount
int numberOfOneDollars = remainingAmount / 100;
remainingAmount = remainingAmount % 100;

//Find number of quarters
int numberOfQuarters = remainingAmount / 25;
remainingAmount = remainingAmount % 25;

//Find number of dimes
int numberOfDimes = remainingAmount / 10;
remainingAmount = remainingAmount % 10;

//Find number of nickels
int numberOfNickels = remainingAmount / 5;
remainingAmount = remainingAmount % 5;

//Find number of pennies
int numberOfPennies = remainingAmount / 1;

//Display
cout << "Your amount " << amount << " consists of \n" <<
cout << numberOfOneDollars << " dollar" << ((numberOfOneDollars == 1) ? "" : "s") << endl;
cout << numberOfQuarters << " quarter" << ((numberOfQuarters == 1) ? "" : "s") << endl;
cout << numberOfDimes << " dime" << ((numberOfDimes == 1) ? "" : "s") << endl;
cout << numberOfNickels << " nickel" << ((numberOfNickels == 1) ? "" : "s") << endl;
cout << numberOfPennies << " penn" << ((numberOfPennies == 1) ? "y" : "ies") << endl;

return 0;
}




error messages

1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

1>C:\Users\Media\Documents\Visual Studio 2008\Projects\monetary_jodie_kretzer\Debug\monetary_jodie_kretzer.exe : fatal error LNK1120: 1 unresolved externals





You're using Microsoft Visual Studio, and when you clicked all those buttons to create a new project, you didn't pick the right one. You should have picked the one marked "Console Application" or something like that.

Make a whole new project, being sure to pick the basic console application, and cut n' paste your code into it.
Thanks! Funny how such a simple error can throw me in a loop. I have another problem though.....

Now the program compiles and runs but when I enter an amount in dollars...It returns random letter and numbers for the amount. I dont see anywhere in my code where this would make that happen.

expl. I inputted 12 and it returns

Your amount of 12 returns
678BDBCC12 dollars
0 quarters
0 dimes
0 nickels
0 pennies


any ideas?
That's not from the code above (the code above says "Your amount ... consists of", not "Your amount of ... returns").
Ok sorry i just assumed what it would say

Your amount 12 consists of

It still has this random number in my dollar
Change

cout << "Your amount " << amount << " consists of \n" <<

to

cout << "Your amount " << amount << " consists of \n";

Topic archived. No new replies allowed.