Flow chart

This is a discussion on Flow chart within the C Programming forums, part of the General Programming Boards category; So i have here a program which is Rental System for a cafe/computer shop. But i don't know how to ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    3

    Flow chart

    So i have here a program which is Rental System for a cafe/computer shop.

    But i don't know how to do this in flow chart. Can someone help me about this stuff?
    Or atleast give me an idea. I have do while.

    Code:
    #define p printf
    #define g gotoxy
    #define s scanf
    #include<stdio.h>
    /*this variable uses to the calculation of each and every hour and minutes*/
    int yes,half,hail,lombey,rental,addm,addh,m22,hr22,amount1,wholeg,wholei,wholesc,wholelc,wholeslb,print,g15,i10,hr1,m1,hr2,m2,hour,minute,amount,sc,lc,slb,total,nump1,nump2,nump3;
    /*for do while variable*/
    char answer;
    main()
    {
    /*if set to yes the it starts again to the very start of the program*/
    lombey:
    clrscr();
    g(18,5);p("WELCOME TO OUR COMPUTER RENTAL SYSTEM!");
    g(20,8);p("BROUGHT TO YOU BY JAYLORD AND RHEM");
    g(18,13);p("Would you like to start now... [   ] Y/N?");
    g(51,13);s("%i",yes);
    if(yes==yes) { goto waley; }
    /*if set to yes it will redirect you here*/
    waley:
    do
    {
    clrscr();
    /*this statement gives you 3 choices*/
    g(5,5);p("[1] GAMING");
    g(5,7);p("[2] INTERNET");
    g(5,9);p("[3] PRINTING");
    g(5,15);p("SELECT SERVICE [   ]");
    g(22,15);s("%i",&rental);
    switch(rental)
    {
    case 1: /*if you set to 1 it will give you this and key in the hour and minutes*/
    	if(rental>3){g(15,21);p("OUT OF SERVICE!!!");}
    	g(50,5);p("GAMING RATE");
    	g(50,6);p("TIME IN  -  :");
    	g(50,7);p("TIME OUT -  :");
    	g(50,15);p("TOTAL HOURS  -   :");
    	g(50,16);p("TOTAL AMOUNT -  ");
    	g(60,6);s("%d",&hr1);
    	g(63,6);s("%d",&m1);
    	g(60,7);s("%d",&hr2);
    	g(63,7);s("%d",&m2);
    	/*after giving value it will give you this calculation*/
    	addh=12;
    	addm=60;
    	/*if hour 1 is greater than hour 2 it will give you this calculation which hour 2 adds 12 into it and 60 on its minute which give you this calculation*/
    	if(hr1>hr2) 
    	{ 
    	hr22=hr2+addh; 
    	m22=m2+addm;
    	g15=15;
    	hour=hr1-hr2;
    	minute=m1-m2;
    	amount=hour*g15;
    	wholeg=amount;
    	g(65,15);p("%d",hour);
    	g(68,15);p("%d",minute);
    	g(65,16);p("%d",amount);
    	}else{
    	/*this wont allow you key in more than 12 hours because its based on 12 hours*/
    	if((hr1>12) || (hr2>12)) 
    	{ 
    	g(15,23); 
    	p("YOU ARE NOT ALLOWED TO ENTER MORE THAN 12 HOURS!");
    	break; 
    	}
    	g15=15;
    	hour=hr2-hr1;
    	minute=m2-m1;
    	amount=hour*g15;
    	wholeg=amount;
    	g(65,15);p("%d",hour);
    	g(68,15);p("%d",minute);
    	g(65,16);p("%d",amount);
    	}
    	break;
    case 2:
    	g(50,5);p("INTERNET RATE");
    	g(50,6);p("TIME IN  -  :");
    	g(50,7);p("TIME OUT -  :");
    	g(50,15);p("TOTAL HOURS  -   :");
    	g(50,16);p("TOTAL AMOUNT -  ");
    	g(60,6);s("%d",&hr1);
    	g(63,6);s("%d",&m1);
    	g(60,7);s("%d",&hr2);
    	g(63,7);s("%d",&m2);
    	addh=12; 
    	addm=60; 
    	if(hr1>hr2) 
    	{
    	hr22=hr2+addh; /*additional 12 hours*/
    	m22=m2+addm; /*additional 60 minutes*/
    	i10=15;
    	hour=hr1-hr2; 
    	minute=m1-m2;
    	amount=(hour*i10)+half;
    	wholei=amount1;
    	g(65,15);p("%d",hour);
    	g(68,15);p("%d",minute);
    	g(65,16);p("%d",amount1);
    	}else{
    	if((hr1>12) || (hr2>12)) 
    	{ 
    	g(15,23); 
    	p("YOU ARE NOT ALLOWED TO ENTER MORE THAN 12 HOURS!"); 
    	}
    	i10=15;
    	hour=hr2-hr1;
    	minute=m2-m1;
    	amount1=hour*i10;
    	wholei=amount1;
    	g(65,15);p("%d",hour);
    	g(68,15);p("%d",minute);
    	g(65,16);p("%d",amount1);
    	}
    	break;
    }/*if you key in 3 then it will execute this program*/
    if(rental==3) {
    clrscr();
    /*this gives you 3 choices on what type of printing do you want and its value*/
    g(5,5);p("PRINTING RATE");
    g(5,7);p("[1] Short Colored: 10.00 PHP");
    g(5,8);p("[2] Long Colored: 12.00 PHP");
    g(5,9);p("[3] Short/Long Black: 7.00 PHP");
    g(5,13);p("SELECT MENU    [   ]");
    g(22,13);s("%i",&print);
    /*higher than 3 will give you this situation which stops you from printing.*/
    if(print>3) { g(26,23);p("OUT OF SERVICE!!!!"); }
    switch(print)
    {/*so this is the calculation of every cases*/
    case 1:
    	sc=10;
    	g(50,10);p("Enter Number of Pieces:");
    	g(75,10);s("%d",&total);
    	nump1=total*sc;
    	wholesc=nump1;
    	g(50,11); p("TOTAL:");
    	g(57,11); p("%d",nump1);
    	break;
    case 2:
    	lc=12;
    	g(50,10);p("Enter Number of Pieces:");
    	g(75,10);s("%d",&total);
    	nump2=total*lc;
    	wholelc=nump2;
    	g(50,11);p("TOTAL");
    	g(57,11);p("%d",nump2);
    	break;
    case 3:
    	slb=7;
    	g(50,10);p("Enter Number of Pieces:");
    	g(75,10);s("%d",&total);
    	nump3=total*slb;
    	wholeslb=nump3;
    	g(50,11);p("TOTAL:");
    	g(57,11);p("%d",nump3);
    	break;
    }
    }
    /*this will give you the choice to do another transaction or no*/
    	g(20,20); p("ANOTHER TRANSACTION [   ] Y/N?");
    	g(42,20); s("%s",&answer);
    	}
    	while(answer=='y');
    	goto Ljay;
    /*if set to n then it will give you this summary*/
    Ljay:
    	clrscr();
    	g(5,5);p("GAMING:");
    	g(5,7);p("INTERNET:");
    	g(5,9);p("PRINTING:");
    	g(10,11);p("Short Colored:");
    	g(10,13);p("Long Colored:");
    	g(10,15);p("Short/Long Black:");
    	g(13,5);p("%d",wholeg);
    	g(15,7);p("%d",wholei);
    	g(25,11);p("%d",wholesc);
    	g(25,13);p("%d",wholelc);
    	g(29,15);p("%d",wholeslb);
    /*after giving you the whole summary it will give you another choices if you would like to try again*/
    	g(20,20); p("THANK YOU FOR USING OUR RENTAL SYSTEM");
    	g(20,22); p("WOULD YOU LIKE TO TRY AGAIN [   ] Y/N?");
    	g(50,22); s("%d",yes);
    	if(yes==yes){ goto lombey; }
    getch();
    }

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Make a little box where your starting point is. Draw some little arrows to the next thing that happens. Repeat until you are at the end box.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    goto? Oh my...

    So, where did you copy this from?

  4. #4
    Registered User
    Join Date
    Mar 2011
    Posts
    3
    LOL? Copy? I didn't copy any of those. I made those on my own.

    Can someone tell me what to do with the do while statement?

  5. #5
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by SimplyNice View Post
    LOL? Copy? I didn't copy any of those. I made those on my own.
    I asked because it's reflective of a programming style I haven't seen in quite a few years... No big deal, just curious...

  6. #6
    Registered User
    Join Date
    Mar 2011
    Posts
    3
    yeah a simple script which is basic. I dont have any idea on how to make a flow chart out of this program. >.<

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help
    By fourseventwo in forum C Programming
    Replies: 4
    Last Post: 12-04-2010, 11:01 PM
  2. flow chart
    By rafay07 in forum C++ Programming
    Replies: 6
    Last Post: 04-13-2010, 01:42 PM
  3. Please help me as fast as possible
    By Xbox999 in forum C Programming
    Replies: 5
    Last Post: 11-30-2009, 06:53 PM
  4. Flow Chart
    By strokebow in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2008, 08:57 AM
  5. flow chart
    By SPOOK in forum C Programming
    Replies: 0
    Last Post: 10-08-2001, 03:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21