Sep 20, 2011 at 9:33pm UTC
Basically, I think i did my code right, but is not executing correctly. I'm not sure if it's the firstchar and secondchar not correctly put in or the nested ifs not set properly. I've been working on this for several days.
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
int length_of_call;
double time_call_started, cost_of_call;
char day_of_week, firstchar, secondchar;
char response;
firstchar = 'M','T','W','F','S';
secondchar = 'o','u','e','h','r','a';
day_of_week = (firstchar + secondchar);
cout << "This program computes the cost of a long-distance call!" <<endl;
do
{
cout << "Enter time you started phone call: \n" ;
cin >> time_call_started;
cout << "Enter day you made phone call: \n";
cin >> day_of_week;
cout << "Enter length of your phone call in minutes: \n";
cin >> length_of_call;
if ( ( time_call_started >= 8 ) && ( time_call_started <= 18 ) );
{
if ( day_of_week == 'M', 'o', 'T', 'u', 'W', 'e', 'h', 'F', 'r');
{
cout << "Your bill concludes to $ " << ( length_of_call * .40 ) <<endl;
}
}
if ( ( time_call_started <= 8) && ( time_call_started >= 18 ));
{
if ( day_of_week == 'M', 'o', 'T', 'u', 'W', 'e', 'h', 'F', 'r' );
{
cout << "Your bill concludes to $" << ( length_of_call * 0.25 ) <<endl;
}
}
if ( day_of_week == 'S', 'a','u');
{
cout << " Your bill concludes to $" << ( length_of_call * .15 ) << endl;
}
cout << "Would you like to start again?\n";
cin >> response;
}
while (response == 'y'|| 'Y');
return 0;
}