示例#1
0
void show()
{
     
     system("cls");
     tick = tick+1;
     for(i=0;i<22;i++);
     
     
p("\n\t\t\tCAVITE BUS\n\t\t\tTRANSIT\n");
p("\n\t\tP %.2f",fare);
p("\n\t\tTicket no.: %4.0f",tick);
p("\n\t\tPassengers: %d",pass);
p("\n\t\tThank you for ");
p("\n\t\triding!"); 
p("\n\t\tHappy Trip!");



          dbase();
 p("\n\n\n\n\t[ MENU ]");
 p("\n\t[1] Print");
 p("\n\t[2] Back to Menu");
 p("\n\tChoice:");
 s("%d",&choice);
 if(choice == 1) { print(); }
 else if(choice == 2) { system("cls");start(); }
 else (choice >=3 ); { p("\n\tINVALID CHOICE!"); getch(); system("cls"); show(); getch(); }
}
示例#2
0
// ARRAYS
void destination()
{  
     
 place[1]=0; place[9]=8;   place[17]=16;
 place[2]=1; place[10]=9;  place[18]=17;
 place[3]=2; place[11]=10; place[19]=18;
 place[4]=3; place[12]=11; place[20]=19;
 place[5]=4; place[13]=12;
 place[6]=5; place[14]=13;
 place[7]=6; place[15]=14;
 place[8]=7; place[16]=15;

 kmeter=(to-fr);
  
 if(kmeter<=3) 
 
 { 
 fare = 15.00;
 }                       // from:1 to:2 = 7.50  wtff
 
 else if(kmeter>=4) 
 
 { 
 fare = ((kmeter*5.00)+15.00); 
 }
 
 else (pass>=2);
 {
 fare = (((kmeter*5.00)+15.00)*pass);
 }//ok
 
 
  
 
 
 dbase();
 
}
示例#3
0
文件: climain.cpp 项目: WndSks/msys
EXTERN_C int climain( int argc, char **argv )
{
    /* Set up the diagnostic message handler, using the console's
     * `stderr' stream for notifications...
     */
    dmh_init( DMH_SUBSYSTEM_TTY, *argv++ );

    /* TODO: insert code here, to interpret any OPTIONS specified
     * on the command line.
     */

    /* Interpret the `action keyword', specifying the action to be
     * performed on this invocation...
     */
    int action = action_code( *argv );
    if( action < 0 )
        /*
         * The specified action keyword was invalid;
         * force an abort through a DMH_FATAL notification...
         */
        dmh_notify( DMH_FATAL, "%s: unknown action keyword\n", *argv );

    /* If we get to here, then the specified action identifies a
     * valid operation; load the package database, according to the
     * local `profile' configuration, and invoke the operation.
     */
    const char *dfile;
    pkgXmlDocument dbase( dfile = xmlfile( "profile" ) );
    if( dbase.IsOk() )
    {
        /* We successfully loaded the basic settings...
         * The configuration file name was pushed on to the heap,
         * by xmlfile(); we don't need that any more, (because it
         * is reproduced within the database image itself), so
         * free the heap copy, to avoid memory leaks.
         */
        free( (void *)(dfile) );

        /* Merge all package lists, as specified in the "repository"
         * section of the "profile", into the XML database tree...
         */
        if( dbase.BindRepositories( action == ACTION_UPDATE ) == NULL )
            /*
             * ...bailing out, on an invalid profile specification...
             */
            dmh_notify( DMH_FATAL, "%s: invalid application profile\n", dbase.Value() );

#if 0
        /* If the requested action was "update", then we've already done it,
         * as a side effect of binding the cached repository catalogues...
         */
        if( action != ACTION_UPDATE )
        {
            /* ...otherwise, we still need to schedule and execute the action request...
             *
             * so, schedule the specified action for each additionally specified command
             * line argument, (each of which is assumed to represent a package name)...
             */
            while( --argc )
                dbase.Schedule( (unsigned long)(action), *++argv );

            /* ...and finally, execute all scheduled actions...
             */
            dbase.ExecuteActions();
        }
#endif

        /* If we get this far, then all actions completed successfully;
         * we are done...
         */
        return EXIT_SUCCESS;
    }

    /* If we get to here, then the package database load failed;
     * once more, we force an abort through a DMH_FATAL notification...
     *
     * Note: although dmh_notify does not return, in the DMH_FATAL case,
     * GCC cannot know this, so we pretend that it gives us a return value,
     * to avoid a possible warning about reaching the end of a non-void
     * function without a return value assignment...
     */
    return dmh_notify( DMH_FATAL, "%s: cannot load configuration\n", dfile );
}