Help me with functions please?
Feb 17, 2016 at 4:17am UTC
Hey guys, I'm trying to output the statements from the "void storeCalculations(char requiredorsugg, char neworold, double possibilityconc)" but when I try to run it, it only reads the int main() and skips over the next function void help pls? I even called it in the int main (last line) but it still won't read the next void function
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <cctype>
using namespace std;
#define storepercent = 0.8
//Declaring other functions other than main
void storeCalculations(char , char , double );
void output(double );
int main()
{
//Holds the user's input
string ISBN;
double pricepercopy, possibilityconc;
char requiredorsugg, neworold;
int classsize;
//Asks for the User's Input
cout << "What is the ISBN?" << endl;
cin >> ISBN;
cout << "What is the price per copy?" << endl;
cin >> pricepercopy;
cout << "What is the class size?" << endl;
cin >> classsize;
cout << "Is the book required or suggested? (R/S): " << endl;
cin >> requiredorsugg;
requiredorsugg = toupper(requiredorsugg);
if (requiredorsugg != 'R' && requiredorsugg != 'S' )
{
cout << "ERROR: Must type R or S" << endl;
system("pause" );
exit(100);
}
cout << "Is the required or suggested book will be new or old? (N / O):" << endl;
cin >> neworold;
neworold = toupper(neworold);
if (neworold != 'N' && neworold != 'O' )
{
cout << "ERROR: Must type N or O" << endl;
system("pause" );
exit(100);
}
system("pause" );
void storeCalculations(char requiredorsugg, char neworold, double possibilityconc);
}
void storeCalculations(char requiredorsugg, char neworold, double possibilityconc)
{
if ((requiredorsugg == 'R' ) && (neworold == 'N' ))
{
possibilityconc = 0.90;
}
if ((requiredorsugg == 'R' ) && (neworold == 'O' ))
{
possibilityconc = 0.65;
}
if ((requiredorsugg == 'S' ) && (neworold == 'N' ))
{
possibilityconc = 0.40;
}
if ((requiredorsugg == 'S' ) && (neworold == 'O' ))
{
possibilityconc = 0.20;
}
cout << possibilityconc << endl;
}
Last edited on Feb 17, 2016 at 4:18am UTC
Feb 17, 2016 at 5:40am UTC
A function call: system("pause" );
A function declaration (not a call): void storeCalculations(char requiredorsugg, char neworold, double possibilityconc);
Topic archived. No new replies allowed.