Help with functions

having issues with learning functions. visual studios keeps saying lines 51-61 have an error with the variable in (). I don't get why it's wrong. Please Help.

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303`` ``````//Going Green Calculator, Designed by James Snook for //Program is designed to figure out the enviromental benefits #include "stdafx.h" #include #include #include using namespace std; // function prototypes string info(string& cinfo); double papers(double& paper); double trees(double& paper, double& tree); double treesc(double& paper, double& treec); double waters(double& paper, double& water); double watersc(double& paper, double& waterc); double energys(double& paper, double& energy); double energysc(double& paper, double& energyc); double pollutions(double& paper, double& pollution); double pollutionsc(double& paper, double& pollutionc); double landfills(double& paper, double& landfill); double landfillsc(double& paper, double& landfillc); double totals(double& treec, double& energyc, double& pollutionc, double& landfillc, double& total); double file(string& cinfo, double); int main() { // get variables string cinfo; //client's info double paper; //pounds of paper we shredded for the client double tree; //trees saved double treec; //tree cost double water; //water saved double waterc; //water cost double energy; //kw of energy saved double energyc; //energy cost double pollution; //pounds of pollution saved double pollutionc; //pollution cost double landfill; //cubic yards of landfill space saved double landfillc; //landfill cost double total = 0; //total savings bool done; //bool to check rather or not total is greater than 0.00 done = (total > 0); while (!done) { cinfo = info(cinfo); paper = papers(paper); tree = trees(tree); treec = treesc(treec); water = waters(water); waterc = watersc(waterc); energy = energys(energy); energyc = energysc(energyc); pollution = pollutions(pollution); pollutionc = pollutionsc(pollutionc); landfill = landfills(landfill); landfillc = landfillsc(landfillc); total = totals(total); done = (total > 0); } system("pause"); return (0); } //*************************************************************************************** string info(string& cinfo) //Get the amount of paper collected { string client; //client's name string caddress; //client's street address string ccity; //client's city string cstate; //client's state string czip; //client's zip code string response; //test if the address is needed cout << "client's name: "; cin >> client; cout << "Are you sending this to a client? Y for yes or N for no: "; cin >> response; if (response="Y") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = client "endl" caddress "endl" ccity ", " cstate " " zip; } else if (response="yes") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = client "endl" caddress "endl" ccity ", " cstate " " zip; } else if (response="Yes") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = client "endl" caddress "endl" ccity ", " cstate " " zip; } else if (response="YEs") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = client "endl" caddress "endl" ccity ", " cstate " " zip; } else if (response="YES") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = client "endl" caddress "endl" ccity ", " cstate " " zip; } else if (response="yES") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = client "endl" caddress "endl" ccity ", " cstate " " zip; } else if (response="yeS") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = client "endl" caddress "endl" ccity ", " cstate " " zip; } else if (response="yEs") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = client "endl" caddress "endl" ccity ", " cstate " " zip; } else if (response="YeS") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = client "endl" caddress "endl" ccity ", " cstate " " zip; } else if (response="y") { cout << "client's street address: "; cin >> caddress; cout << "clients city: "; cin >> ccity; cout << "Clients state: "; cin >> cstate; cout << "clients zip code: "; cin >> czip; cinfo = (client "endl" caddress "endl" ccity ", " cstate " " zip); } else if (response="n") { cinfo = client; } else if (response="no") { cinfo = client; } else if (response="NO") { cinfo = client; } else if (response="No") { cinfo = client; } else if (response="nO") { cinfo = client; } else if (response="N") { cinfo = client; } else { cout << "please enter Y for Yes or N for NO. How hard is that?"; } return (cinfo); } //*************************************************************************************** double papers(double& paper) //Get the amount of paper collected { cout << "Pounds of paper collected: "; cin >> paper; return (paper); } //*************************************************************************************** double trees(double& paper, double& tree) { tree = ((paper)/17); return(tree); } //*************************************************************************************** double treesc(double& paper, double& treec) { treec = ((paper)/250); return(treec); } //*************************************************************************************** double waters(double& paper, double& water) { water = ((paper)/7000); return(water); } //*************************************************************************************** double watersc(double& paper, double& waterc) { waterc = ((paper)/(.0045 * 7000)); return(waterc); } //*************************************************************************************** double energys(double& paper, double& energy) { energy = ((paper)/4100); return(energy); } ``````
Code continuation
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647`` ``````//*************************************************************************************** double energysc(double& paper, double& energyc) { energyc = ((paper)/(.08 * 7000)); return(energyc); } //*************************************************************************************** double pollutions(double& paper, double& pollution) { pollution = ((paper)/(60)); return(pollution); } //*************************************************************************************** double pollutionsc(double& paper, double& pollutionc) { pollutionc = ((paper)/(5)); return(pollutionc); } //*************************************************************************************** double landfills(double& paper, double& landfill) { landfill = ((paper)/(5)); return(landfill); } //*************************************************************************************** double landfillsc(double& paper, double& landfillc) { landfillc = ((paper)/(50)); return(landfillc); } //*************************************************************************************** double totals(double& treec, double& energyc, double& pollutionc, double& landfillc, double& total) { total = (treec + energyc + pollutionc + landfillc); return(total); }``````
Last edited on
Topic archived. No new replies allowed.