C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 23rd, 2012, 01:05 PM
sei_liam sei_liam is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 sei_liam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 29 sec
Reputation Power: 0
General - C++ Looping Help!!!

do
{
cout<<"When did the call start?\n";
cout<<"Please enter the time in 24-hour notation.\n";
cin>>start_time;
cout<<"How long did the call last?\n";
cin>>minutes;
cout<<"Please enter the first two letters of the day of the call.\n";
cin>>first>>second;

if ((((first=='M')||(first=='m'))&&((second=='O')||(second=='o'))) || (((first=='T')||(first=='t'))&&((second=='U')||(second=='u'))) || (((first=='W')||(first=='w'))&&((second=='E')||(second=='e')))
|| (((first=='T')||(first=='t'))&&((second=='H')||(second=='h'))) || (((first=='F')||(first=='f'))&&((second=='R')||(second=='r'))))
{
if ((start_time>=800) &&(start_time<=1800))

{
cost=minutes*.40;
}
else
{
cost=minutes*.25;
}
}

else if ((((first=='S')||(first=='s'))&&((second=='A')||(second=='a'))) || (((first=='S')|| (first=='s'))&& ((second=='U')||(second=='u'))))
{
cost=minutes*.15;
}

else
{


cout<<"\nYour response is invalid. Please try again."<<endl;
cout << "Please enter the day of the call (Mo/Tu/We/Th/Fr/Sa/Su):";
cin >> first>>second;

}



How do I make the BOLD part to continuously prompt user until a valid response is given?

I tried using boolean, do-while, but I can't seems to make it work.

Please help.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > General - C++ Looping Help!!!


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap