Results 1 to 12 of 22

Thread: c++ challan calculator for traffic violations program

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Arslan-vu's Avatar
    Arslan-vu is offline Senior Member+
    Last Online
    2nd March 2018 @ 09:50 PM
    Join Date
    22 Mar 2013
    Gender
    Male
    Posts
    326
    Threads
    115
    Credits
    447
    Thanked
    88

    Default c++ challan calculator for traffic violations program

    #include<iostream.h>
    #include<conio.h>

    main()

    {
    char i;
    int a, b;

    do
    {
    system("cls");
    cout<<"******Challan Calculator for Traffic Violations******";
    cout<<endl;
    cout<<endl;
    cout<<"Enter '1' for Breaking Signal:";
    cout<<endl;
    cout<<"Enter '2' for Over Speed:";
    cout<<endl;
    cout<<"Enter '3' for Wearing not Seat Belt:";
    cout<<endl;
    cout<<endl;
    cout<<"Enter the type of traffic violation 1, 2 or 3:";
    cin>>a;
    cout<<endl;
    switch(a)
    {
    case 1:
    cout<<"Enter the numbers of days passed till challan date:";
    cin>>b;
    cout<<endl;

    if(b<=10)cout<<"The total fine is Rs: "<<500;
    else if (b<=30)cout<<"The total fine is Rs: "<<500*2;
    else if (b>30)cout<<"The total fine is Rs: "<<(500*2)+(500/2);
    break;
    case 2:
    cout<<"Enter the numbers of days passed till challan date:";
    cin>>b;
    cout<<endl;

    if(b<=10)cout<<"The total fine is Rs: "<<300;
    else if (b<=30)cout<<"The total fine is Rs: "<<300*2;
    else if (b>30)cout<<"The total fine is Rs: "<<(300*2)+(300/2);

    break;
    case 3:
    cout<<"Enter the numbers of days passed till challan date:";
    cin>>b;
    cout<<endl;

    if(b<=10)cout<<"The total fine is Rs: "<<200;
    else if (b<=30)cout<<"The total fine is Rs: "<<200*2;
    else if (b>30)cout<<"The total fine is Rs: "<<(200*2)+(200/2);
    break;
    default:
    cout<<endl;
    cout<<endl;
    cout<<"Please Enter a Valid Type of Traffic Violation:";
    cout<<endl;
    cout<<endl;
    getch();
    cout<<endl;
    cout<<endl;
    system("cls");
    main();
    break;

    }

    cout<<endl;
    cout<<endl;
    cout<<"Do you want another challan calculation? (y/n):";
    cin>>i;
    }
    while(i != 'N' && i != 'n' );

    }
    Attached Images Attached Images  

Similar Threads

  1. program plz 4
    By PREMkhan in forum Ask an Expert
    Replies: 1
    Last Post: 25th May 2010, 11:53 PM
  2. Solved plz help me in the following c++ program
    By raza89 in forum Solved Problems (IT)
    Replies: 4
    Last Post: 19th October 2009, 08:29 AM
  3. Share ur Eid Program
    By ussmaan in forum Baat cheet
    Replies: 3
    Last Post: 21st September 2009, 12:46 AM
  4. Replies: 8
    Last Post: 19th May 2009, 05:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •