941,518 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1096
  • C++ RSS
Jul 25th, 2006
0

My Emergency Airtime Recharge Service

Expand Post »
Hello All,Iam Obi fronm Nigeria and has been studying c++ for some time now .I recently took on a challenge to design a kind of airtime service for the mobile communication industry but can only say that I have not really delivered on that.Below is the code and I would welcome useful suggestions on how to improve on this code.I don't have any contract with anyone and therefore would not mind any delay.The service is supposed to let the subscriber access aitime worth 200 units of currency after which he is billed whenever he recharges.Is this the best way to go about it?


C++ Syntax (Toggle Plain Text)
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4. int main()
  5. {
  6. float ac_bal=0.0;
  7. int recharge_no;
  8.  
  9.  
  10. bool status=false;
  11.  
  12. cout<<"You can use the emergency service now"<<endl;
  13. cout<<"Have a nice time"<<endl;
  14. cout<<"Enter your 4-digit number now for the EAR or your 5-digit number"<<endl;
  15. cout<<"for the regular service,Have a nice time"<<endl;
  16. cin>>recharge_no;
  17.  
  18. if(status==true){
  19. if(recharge_no==3553){
  20.  
  21. ac_bal +=200.0;
  22. val_period +=1;
  23. status=false;
  24. cout<<"Your account balance now is "<<ac_bal<<endl;
  25. cout<<"Your EAR status is "<<status<<endl;exit(0);}}
  26.  
  27. if(status==true){
  28. switch(recharge_no){
  29. case(1234):ac_bal+=100.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  30. case(1235):ac_bal+=200.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  31. case(1225):ac_bal+=300.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  32. case(1215):ac_bal+=500.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  33. case(1205):ac_bal+=1000.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  34. case(1995):ac_bal+=3000.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  35. case(1985):ac_bal+=6000.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  36. default:cout<<"Wrong number on network!,Try Again or check your Ear status"<<endl;exit(0);
  37.  
  38. }}
  39.  
  40.  
  41. if(status==false){
  42. switch(recharge_no){
  43. case(1234):ac_bal+=50.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  44. case(1235):ac_bal+=100.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  45. case(1225):ac_bal+=200.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  46. case(1215):ac_bal+=300.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  47. case(1205):ac_bal+=800.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  48. case(1995):ac_bal+=2800.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  49. case(1985):ac_bal+=5800.0;cout<<"Your account balance now is "<<ac_bal<<endl;break;
  50. default:cout<<"Wrong number on network!,Try Again"<<endl;exit(0);
  51. cout<<"Your account balance is now "<<ac_bal<<endl;
  52. }
  53. status=true;}
  54. cout<<"Your EAR status is "<<status<<endl;
  55. return 0;
  56. }
Last edited by WolfPack; Jul 25th, 2006 at 11:00 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
justobioma is offline Offline
5 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: strstr() help c++
Next Thread in C++ Forum Timeline: function for merging two lists





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC