Alright fixed that and now I don't have any errors shown but the build is failing.
Here's my updated code
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
//function prototype
int getFatCals(int);
double getFatPercent(int, int);
int main()
{
//declare variables
int totalCals = 0;
int fatGrams = 0;
int fatCals = 0;
double fatPercent = 0.0;
//get input items
cout << "Total Calories? ";
cin >> totalCals;
cout << "Grams of fat? ";
cin >> fatGrams;
//call function to Fat calories and fat Percentage
fatCals = getFatCals(fatGrams * 9);
fatPercent = getFatPercent(static_cast<double>(fatCals)/ static_cast<double>(totalCals) * 100);
//display
cout << fixed << setprecision(2) << endl;
cout << "Fat Calories: " << fatCals << endl;
cout << "Fat Percent: " << fatPercent << endl;
system("pause");
return 0;
} //end of main function
//*****function definitions*****
int getFatCals(int fatGram)
{
//calculates and returns fat grams
int getFatCals = 0.0;
getFatCals = fatGram * 9;
return getFatCals;
} //end of getFatCals function
double getFatPercent(int fatCal, int totalCal)
{
//calculates and returns fat percent
double getFatPercent = 0.0;
getFatPercent = static_cast<double>(fatCal)/ static_cast<double>(totalCal) * 100;
return getFatPercent;
} //end of getFatPercent function
|
and here's whats in the build log.
1>------ Build started: Project: Example , Configuration: Debug Win32 ------
1>Build started 4/7/2013 10:14:58 PM.
1>InitializeBuildStatus:
1> Touching "Debug\example.unsuccessfulbuild".
1>ClCompile:
1> Example.cpp
1>c:location\Example.cpp(32): error C2660: 'getFatPercent' : function does not take 1 arguments
1>c:\location\Example.cpp(47): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.77
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========