Hi guys I only started programming a few weeks back so forgive my noobishness but I'm studying for a degree in IT. This assignment is for calculating call costs, durations, discounts etc etc etc. Here's the coding so far... //A program by Scott Brade to calculate call costs. //10/10/08 #include <iostream.h> #include<stdio.h> double mins,totmins,fullcost,actualcost,discount,day1; char day; void parking() { { cout<<"+----------------------------+\n"; cout<<"| M = Monday |\n"; cout<<"| T = Tuesday |\n"; cout<<"| W = Wednesday |\n"; cout<<"| U = Thursday |\n"; cout<<"| F = Friday |\n"; cout<<"| A = Saturday |\n"; cout<<"| S = Sunday |\n"; cout<<"+----------------------------+\n\n"; } cout<<"Enter minutes\n\n"; cin>>totmins; cout<<"What day is it?\n\n"; cin>>day; cin>>day1; if(totmins<30) { fullcost=1.25; } else if(totmins>=30) { fullcost=(((totmins-30)*.20)+1.25); } } void discounts() { if ((day == 'M')||(day == 'T')) { discount=0.6; } else { discount=0.3; } cout<<endl; cout<<endl; cout<<endl; cout<<"Your parking cost is on "<<day1 <<fullcost; cout<<endl; discount=(fullcost*discount); cout<<"Discount "<<discount; cout<<endl; //actualcost=() } void main() { parking(); discounts(); } PHP: I'm trying to use the input "Please enter day" as both a variable & function so the user doesn't need to input the day twice. Is this possible as it doesn't work at the moment. cout<<"What day is it?\n\n"; cin>>day; cin>>day1; PHP:
cin>>day; cin>>day1; PHP: Why your requesting more than 1 cin without an additional output for user ? I will enter day1, but app will wait for another .. Next thing, function is not the same as variable ! you create a cin containing function for example .. GetUserInput, and after that use your day1 or any other variables
cin>>xyz; cout<<xyz<<"is the value "<<endl; endl should be used for next line instead of what u use. you used some of the c language conventions.... You can contact me or PM for any assistant in C++, Java, Oracle, SQL, PL-SQL, Mysql..... Thank yOU.