• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ clrscr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中clrscr函数的典型用法代码示例。如果您正苦于以下问题:C++ clrscr函数的具体用法?C++ clrscr怎么用?C++ clrscr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了clrscr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

void main()
{
 int a,b,c,x,y,z,choice;
 char choice2;
 bool ans;
 do
  {
   clrscr();
   cout<<"\n\n\t\t\t\tMENU\n\n\t\t1. Addition\n\t\t2. Subtraction"
       <<"\n\t\t3. Post Increment\n\t\t4. Post Decrement"
       <<"\n\t\t5. Pre Increment\n\t\t6. Pre Decrement"
       <<"\n\t\t7. Comparison\n\t\t8. Assignment Addition"
       <<"\n\t\t9. Assignment Subtraction";
   cout<<"\n\n\tEnter your choice (1-9) : ";
   cin>>choice;
   if(choice==3||choice==4||choice==5||choice==6)
    {
     cout<<"\n\n\n\tEnter Time 1 (hr) : ";
     cin>>a;
     cout<<"\t\t    (min) : ";
     cin>>b;
     cout<<"\t\t    (sec) : ";
     cin>>c;
    }
   else
    {
     cout<<"\n\n\n\tEnter Time 1 (hr) : ";
     cin>>a;
     cout<<"\t\t    (min) : ";
     cin>>b;
     cout<<"\t\t    (sec) : ";
     cin>>c;
     cout<<"\n\tEnter Time 2 (hr) : ";
     cin>>x;
     cout<<"\t\t    (min) : ";
     cin>>y;
     cout<<"\t\t    (sec) : ";
     cin>>z;
    }
   time t1(a,b,c),t2(x,y,z),t3;
   switch(choice)
    {
     case 1:t3=t1+t2;
	    cout<<"\n\n\tTime 3 = Time 1 + Time 2"
		<<"\n\n\tTime 3 = ";
	    t3.display();
	    break;
     case 2:t3=t1-t2;
	    cout<<"\n\n\tTime 3 = Time 1 - Time 2"
		<<"\n\n\tTime 3 = ";
	    t3.display();
	    break;
     case 3:t3=t1++;
	    cout<<"\n\n\tTime 3 = Time 1 ++"
		<<"\n\n\tTime 3 = ";
	    t3.display();
	    break;
     case 4:t3=t1--;
	    cout<<"\n\n\tTime 3 = Time 1 --"
		<<"\n\n\ttime 3 = ";
	    t3.display();
	    break;
     case 5:t3=++t1;
	    cout<<"\n\n\tTime 3 = ++ Time 1"
		<<"\n\n\tTime 3 = ";
	    t3.display();
	    break;
     case 6:t3=--t1;
	    cout<<"\n\n\tTime 3 = -- Time 1"
		<<"\n\n\tTime 3 = ";
	    t3.display();
	    break;
     case 7:ans=t1<t2;
	    cout<<"\n\n\tAns = Time 1 < Time 2"
		<<"\n\n\tAns = ";
	    if(ans==true)
	     cout<<"True";
	    else
	     cout<<"False";
	    ans=t1>t2;
	    cout<<"\n\n\tAns = Time 1 > Time 2"
		<<"\n\n\tAns = ";
	    if(ans==true)
	     cout<<"True";
	    else
	     cout<<"False";
	    break;
     case 8:t3=t1+=t2;
	    cout<<"\n\n\tTime 3 = Time 1 += Time 2"
		<<"\n\n\tTime 3 = ";
	    t3.display();
	    break;
     case 9:t3=t1-=t2;
	    cout<<"\n\n\tTime 3 = Time 1 -= Time 2"
		<<"\n\n\tTime 3 = ";
	    t3.display();
	    break;
     default:cout<<"\n\n\tInvalid Choice";
    }
   cout<<"\n\n\tWant to continue (y/n) : ";
//.........这里部分代码省略.........
开发者ID:errohitagg,项目名称:btech-lab,代码行数:101,代码来源:OPOVER.CPP


示例2: main

void main ( )
{

    int *base, *tope, *avail, *max ;
    int n,inf,crear_pila;
    unsigned int sw;
    char opcion;

    // creacion del menu de pila lls

    sw=0;
    do {
        clrscr();
        gotoxy (35,2);
        printf ("M  E  N  U ");
        gotoxy (32,3);
        printf (" MANEJO DE PILAS");
        gotoxy (15,6);
        printf ("1_CREAR PILA");
        gotoxy (15,8);
        printf ("2_INCLUIR NODO EN UNA PILA(PUSH)");
        gotoxy (15,10);
        printf ("3_CANCELAR NODO EN UNA PILA(POP)");
        gotoxy (15,12);
        printf ("4_MOSTRAR PILA");
        gotoxy (15,14);
        printf ("5_ SALIR\n\n");
        //  gotoxy (15,20);
        printf ("DIGITE OPCION : ");
        do {
            opcion=getchar ( );
        } while ( opcion<'0' && opcion>'5');
        switch(opcion) {

        case '1':
            if (sw==0) {
                sw=1;
                clrscr ( );
                // definir el espacio disponible

                printf("DIGITE EL MAXIMO NUMERO DE NODOS DE LA LISTA");
                do {
                    scanf ("%d",&n);
                } while (n<=0);
                crear_pila (&base,&tope,n);
                max=Maximo (base,n);
                printf ("  BASE=%04X:%04X\n",FP_SEG(base),FP_OFF(base));
                printf ("  TOPE=%04X:%04X\n",FP_SEG(tope),FP_OFF(tope));
                printf ("\n MAXIMO=%04X:%04X\n",FP_SEG(max),FP_OFF(max));
                printf ("\n  DIGITE 0 Y <ENTER> CONTONUA");
                do {
                    opcion=getchar ( );
                } while (opcion !='0');
            }
            else {
                clrscr ( );
                printf ("PILA YA CREADA.. DIGITE O Y <ENTER> CONTINUA");
                do {
                    opcion=getchar();
                } while (opcion !='0');
            }
            break;


        case '2':
            if (sw==1) {
                clrscr();
                printf ("\n DIGITE INFORMACION DEL NODO A INCLUIR");
                scanf ("%d",&inf);
                Push(&tope,max,inf);
            }
            else {
                clrscr();
                printf ("PILA NO CREADA.. DIGITE 0 Y <ENTER> CONTINUA");
                do {
                    opcion=getchar ( );
                } while (opcion !='0');
            }
            break;


        case '3':
            if (sw==1) {
                clrscr();
                Pop (&tope,base,&inf);
                printf ("\n NODO CANCELADO=%d",inf);
                printf ("\n \n DIGITE 0 Y <ENTER> CONTINUA");
                do {
                    opcion=getchar ( );
                } while (opcion!='0');

            }
            else {
                clrscr();
                printf ("PILA NO CREADA.. DIGITE 0 Y <ENTER> CONTINUA");
                do {
                    opcion=getchar ( );
                } while (opcion!='0');
            }
            break;
//.........这里部分代码省略.........
开发者ID:agudeloandres,项目名称:C_Struct_Files,代码行数:101,代码来源:MENP.CPP


示例3: i2r

void i2r(l2ist * l1, int op)
{
    int elem,elem2,cont,est;
    n2od * act=l1->start;
    if(op==1)
    {
	printf("");
    }
    else if( l1->size==0 )
    {
	printf("Ingrese un elemento: ");
        scanf("%d",&elem);
        i2ns(l1,elem,0,1);
	i2r(l1,op);
    }
    else
    {
    	printf("Lista: \n");
    	i2mp(l1);
	if(l1->size!=1)
        {
	    printf("¿Salir? 1/0: ");
            scanf("%d",&op);
	    if(op==1)
	    	cont=99;
	}
	if(cont != 99)
	{
	    do
	    {
	    	printf("Ingrese el elemento de referencia: ");
	    	scanf("%d",&elem2);
		while(act != NULL)
		{
		    if(act->x == elem2)
		    {
			est=0;
			break;
		    }
		    else
			est=1;
		    act=act->next;
		}
		if(est)
		{
		    clrscr();
		    printf("El elemento no está\n");
		    getch();
		}
    		printf("Lista: \n");
    		i2mp(l1);
		act=l1->start;
	    } while(est);
	    printf("Ingrese un elemento: ");
            scanf("%d",&elem);
            i2ns(l1,elem,elem2,3);
	}
        i2r(l1,op);
	
    }
}
开发者ID:c4explosive,项目名称:LabDatos_ListasEnlazadas,代码行数:61,代码来源:lista7.c


示例4: contacts

void contacts()
{

  /************************Select these afterwards***********************




 int choice;

 char name[]="Welcome to Contact Manager";
 startup(name);
 //char intro[]="This is a unique feature of the James Gleick Messenger. This enables you to add contacts and make frineds within James Gleick Network. Before you get on with some 'Real Networking' this is very essential. It is highly recommended that you perform this, although it is not compulsory.";
 slowprin();

 //***********source program slide.cpp in my programs folder

 int i,j;
 char p[]=" 1. Yes. Ok. Proceed";
 char s[]=" 2. No. I'll Do it later.";
 for(i=0,j=62;i<=26;i+=1,j-=1)
 {
  clrscr();
  {
   int len;
   //char ch=97; //name[]="PG Database Securities";
   int l=(80-(strlen(name)))/2;
   gotoxy(l,3);
   cout<<name<<"\n\n\n";
   ifstream fin45("C:\\JG MSG\\settings\\conintro.txt");
   char intro[80];

   while(fin45.getline(intro,80))
   {
    len=strlen(intro);
    for(int i=0;i<len;i+=1)
    {
     cout<<intro[i];
    }
    cout<<"\n";
   }
    fin45.close();
  }
  gotoxy(i,12);
  puts(p);
  gotoxy(j,14);
  puts(s);
  delay(25);
 }
 delay(2000);




 cout<<"\n\n\n\t\t\t Enter your choice : ";
 cin>>choice;






 for(;i>=0&&j<=62;i-=1,j+=1)
 {
  clrscr();
  {
   int len;
   //char ch=97; //name[]="PG Database Securities";
   int l=(80-(strlen(name)))/2;
   gotoxy(l,3);
   cout<<name<<"\n\n\n";
   ifstream fin45("C:\\JG MSG\\settings\\conintro.txt");
   char intro[80];
   while(fin45.getline(intro,80))
   {
    len=strlen(intro);
    for(int i=0;i<len;i+=1)
    {
     cout<<intro[i];
    }
    cout<<"\n";
   }
    fin45.close();
  }
  gotoxy(i,12);
  puts(p);
  gotoxy(j,14);
  puts(s);
  delay(25);
 }

 ****************************Select afterwards***************/



 clrscr();
 char name[]="Welcome to Contact Manager";
 int l=(80-(strlen(name)))/2;
 gotoxy(l,3);
 cout<<name;
//.........这里部分代码省略.........
开发者ID:dtsdwarak,项目名称:james_gleick_messenger,代码行数:101,代码来源:CONTACT4.CPP


示例5: main

void main(void)
{
    int code;
    int exit_code;
    int argc;
    char **argv;
    char dformat[64], ddevice[32];
    SInt32        response;

    /* Initialize operating environment */
#if TARGET_API_MAC_CARBON
    MoreMasterPointers(224);
#else
    MoreMasters();
#endif
    InitCursor();
    FlushEvents(everyEvent,0);

    if (AEInstallEventHandler(kCoreEventClass,kAEQuitApplication,
                              NewAEEventHandlerUPP((AEEventHandlerProcPtr) quitAppEventHandler),
                              0L,false) != noErr)
        ExitToShell();

        gActionFunctionScrollUPP = NewControlActionUPP(&actionFunctionScroll);

    Gestalt(gestaltMenuMgrAttr,&response);
    if(response & gestaltMenuMgrAquaLayoutMask)
                gRunningOnX = true;

    /* Initialize SIOUX */
    SIOUXSettings.initializeTB = false;
    SIOUXSettings.standalone = false;
    SIOUXSettings.asktosaveonclose = false;
    SIOUXSettings.sleep = GetCaretTime();
    SIOUXSettings.userwindowtitle = "\pGhostscript";

    /* Get arguments from user */
    argc = ccommand(&argv);

    /* Show command line window */
    if (InstallConsole(0))
        ExitToShell();

    /* Part of fudge to make SIOUX accept characters without becoming modal */
    SelectWindow(SIOUXTextWindow->window);
    PostEvent(keyDown, 0x4c00);  // Enter
    ReadCharsFromConsole(dformat, 0x7FFF);
    clrscr();

    /* Add in the display format as the first command line argument */
    if (argc >= MAX_ARGS - 1)
    {
       printf("Too many command line arguments\n");
       return;
    }

    memmove(&argv[3], &argv[1], (argc-1) * sizeof(char**));
    argc += 2;
    argv[1] = ddevice;
    argv[2] = dformat;

    gs_sprintf(ddevice, "-sDEVICE=display");
    gs_sprintf(dformat, "-dDisplayFormat=%d", display_format);

    /* Run Ghostscript */
    if (gsapi_new_instance(&instance, NULL) < 0)
    {
       printf("Can't create Ghostscript instance\n");
       return;
    }

#ifdef DEBUG
    visual_tracer_init();
    set_visual_tracer(&visual_tracer);
#endif

    gsapi_set_stdio(instance, gsdll_stdin, gsdll_stdout, gsdll_stderr);
    gsapi_set_poll(instance, gsdll_poll);
    gsapi_set_display_callback(instance, &display);

    code = gsapi_init_with_args(instance, argc, argv);
    if (code == 0)
       code = gsapi_run_string(instance, start_string, 0, &exit_code);
    else
    {
       printf("Failed to initialize. Error %d.\n", code);
       fflush(stdout);
    }
    code = gsapi_exit(instance);
    if (code != 0)
    {
       printf("Failed to terminate. Error %d.\n", code);
       fflush(stdout);
    }

    gsapi_delete_instance(instance);

#ifdef DEBUG
    visual_tracer_close();
#endif
//.........这里部分代码省略.........
开发者ID:hackqiang,项目名称:gs,代码行数:101,代码来源:dmmain.c


示例6: main

void main(){clrscr();
rectangle_box(1, 1, 77, 24);
getch();}
开发者ID:anojknarf,项目名称:cstuff,代码行数:3,代码来源:BORDER.CPP


示例7: get_user_time

//***************************************************
// function to get time duration from user
//***************************************************
void get_user_time(void)
{
  U8 uc_lcd_data_user_time[30] = {"Enter Time: "};
  U8 uc_lcd_data_user_temp[30] = {"Enter Temp: "};
  U8 sc_set_time_count = 0;
  U8 uc_set_temp_count = 0;

  clrscr();
  lcd_line1_disp(&uc_lcd_data_user_time[0],0);
  lcd_line1_disp(&Uc_set_user_time[0],12);
 
  while(sc_set_time_count < 8)					 //uc_set_time_count < 9
  {
  	wdt_feed(0x03ffffff);
	Uc_key_temp = get_key(1);
	pwm5_pulse_width(5000, 100);
	//pwm_enable();

	if((Uc_key_temp <= '9')&(Uc_key_temp >= '0'))
	{
		if(sc_set_time_count == 0)
		{
			
			if(Uc_key_temp < '3')
			{
				Uc_set_user_time[sc_set_time_count] = Uc_key_temp;
				sc_set_time_count += 1;
			}
		}
		else if(sc_set_time_count == 1)
		{
		   if((Uc_set_user_time[0] - 0x30) == 2)
		   {
			if(Uc_key_temp < '4')
			{
				Uc_set_user_time[sc_set_time_count] = Uc_key_temp;
				sc_set_time_count += 2;
			}
		   }
		   else
		   {
		   		Uc_set_user_time[sc_set_time_count] = Uc_key_temp;
				sc_set_time_count += 2;
		   }
		}
		else if(sc_set_time_count == 3)
		{
			
		  	if(Uc_key_temp < '6')
			{
				Uc_set_user_time[sc_set_time_count] = Uc_key_temp;
				sc_set_time_count += 1;
			}
		}
		else if(sc_set_time_count == 4)
		{
		 	
			Uc_set_user_time[sc_set_time_count] = Uc_key_temp;
			sc_set_time_count += 2;
			
		}
		else if(sc_set_time_count == 6)
		{
		  	
			if(Uc_key_temp < '6')
			{
				Uc_set_user_time[sc_set_time_count] = Uc_key_temp;
				sc_set_time_count += 1;
			}
		}
		else if(sc_set_time_count == 7)
		{
		  	
			if(Uc_key_temp < 'A')
			{
				Uc_set_user_time[sc_set_time_count] = Uc_key_temp;
				sc_set_time_count += 1;
			}
		}

	}

	if(Uc_key_temp == 'A')
	{	  	
		  lcd_line2_disp(&uc_lcd_data_user_temp[0],0);
		  lcd_line2_disp(&Uc_set_temp[0],12);
		  sc_set_time_count = 8;
		  uc_set_temp_count	= 3;
	}
	//*********************************************//
  
  	if(sc_set_time_count == 0)
	{
		lcd_line4_disp("Range 0-2",11);
	}
	if(sc_set_time_count == 1)
	{
//.........这里部分代码省略.........
开发者ID:dpmjoshi,项目名称:ARM7,代码行数:101,代码来源:app.c


示例8: add_reservation

void add_reservation(FILE *reguPtr, FILE *reroPtr)
{
   int available, response;
	struct room rooms = { 0, 0, 0.00, 0, 0}; /* default room information*/
   struct reserve guest = {"", "", "", "", 0, "", 0,0.00, 0}; /* default reserve information*/
   clrscr();
   printf("\t\t\tadd_reservation\n\n\n");

   printf("\nEnter last name: "); fflush(stdin); gets(guest.text);
   sscanf(guest.text,"%s",guest.last_name); /* NOTE: no & */

   printf("If this incorrect press \"Y\" (Any key continue)");
   response = getch();

   while (response == 'Y' || response == 'y'){
   	printf("\nEnter last name: ");
   	gets(guest.text);
   	sscanf(guest.text,"%s",guest.last_name);	/* NOTE: no & */

   	printf("If this incorrect press \"Y\" (Any key continue)");
   	response = getch();
   }

   printf("\n\nGuest Mr\\Ms %s. \nEnter first name: ",guest.last_name);
   gets(guest.text);
   sscanf(guest.text,"%s",guest.first_name);	/* NOTE: no & */
   printf("If this incorrect press \"Y\" (Any key continue)");
 	response = getch();

   while (response == 'Y' || response == 'y'){
		printf("\nGuest Mr\\Ms %s. \nEnter first name: ",guest.last_name);
   	gets(guest.text);
   	sscanf(guest.text,"%s",guest.first_name);	/* NOTE: no & */

   	printf("If this incorrect press \"Y\" (Any key continue)");
   	response = getch();
   }

   /* ------ Add the names together ------ */
   strcpy(guest.full_name,guest.first_name);	/* First copy the first	*/
   strcat(guest.full_name," ");		/* name then add a space*/
   strcat(guest.full_name,guest.last_name);	/* and last name.	*/

   /* ------ Some display using puts() ------ */

   printf("\n\n");
   printf("\t================================\n");
   printf("\t\t%s\n",guest.full_name);
   printf("\t================================");
   printf("\n");

   printf("Enter length-of-stay(Days): ");
   scanf("%d", &guest.lenght_of_stay);
   fflush(stdin);  /* flush the input stream in case of bad input */

   printf("Enter credit card number: ");
   scanf("%d", &guest.credit_card_num);
   fflush(stdin);  /* flush the input stream in case of bad input */

   printf("Please choose room type -: \n"
   		 "\t0. Smoking\n"
     		 "\t1. Non-Smoking\n"
     	 	 "Option: ");
   scanf("%d", &guest.prefered_room_type);
   fflush(stdin);  /* flush the input stream in case of bad input */

   while (guest.prefered_room_type != 0 && guest.prefered_room_type != 1){
   	printf("\n\aWrong Input!!!\n\n");
   	printf("Please choose room type -: \n"
   		    "\t0. Smoking\n"
     		    "\t1. Non-Smoking\n"
     		    "Option: ");
		scanf("%d", &guest.prefered_room_type);
      fflush(stdin);  /* flush the input stream in case of bad input */
   }

   if (guest.prefered_room_type == 0 || guest.prefered_room_type == 1){
      available = 0;
   	while ( (!feof(reroPtr)) && (available == 0) ){
      	fread(&rooms, sizeof(struct room), 1, reroPtr);
   		if ( (rooms.room_type == guest.prefered_room_type) && (rooms.status == 0) ){

     			available = 1;
            printf("\nRoom #%d was found. Do you want to reserve this room? (Y\\N)", rooms.room_num);
            response = getch();
				if ((response == 'n') || (response == 'N')) {
					available = 0; // allow user to move on & see the next room
      		}
            else{
					rooms.status = 2; /* change room status to reserved  */
					guest.balance = rooms.cost;
               printf("\nRoom %d is reserved for you Mr\\Ms %c. %s", rooms.room_num, guest.first_name[0],guest.last_name);
               srand(time(NULL));
   				guest.guest_num = rand()% 1000 + 9000;
     				printf("\nYour Guest# is: %d", guest.guest_num);
      			rooms.guest_num = guest.guest_num;

           		printf("\n\nPlease wait while data is being stored!\n");
			     	Sleep(1000); printf(">>>>."); Sleep(1000); printf(">>>>."); Sleep(1000); printf(">>>>."); Sleep(1000);

//.........这里部分代码省略.........
开发者ID:nnation,项目名称:in-the-beginning-was-C,代码行数:101,代码来源:ssiproj.c


示例9: cancel_reservation

void cancel_reservation(FILE *reguPtr, FILE *reroPtr)
{
   int roomNum, response, found;
   char	holdtext[50], holdlast_name[50];
	struct room rooms = { 0, 0, 0.00, 0, 0}; /* default room information*/
   struct reserve guest = {"", "", "", "", 0, "", 0,0.00, 0}; /* default reserve information*/
   clrscr();
   printf("\t\t\tcancel_reservation\n\n\n");

   printf("Please enter details to query!\n\n");
   printf("Enter room number: ");
   scanf("%d", &roomNum);
   fseek(reroPtr, (roomNum - 1)*sizeof(struct room), SEEK_SET);
	fread(&rooms, sizeof(struct room), 1, reroPtr);

   if(rooms.room_num == 0){
   	printf("\nRoom #%d has no Information!!!", roomNum);
      Sleep(1000);
      rewind(reroPtr);
      return;
   }
   else {
   	   printf("\nEnter last name: "); fflush(stdin); gets(holdtext);
		   sscanf(holdtext,"%s",holdlast_name); /* NOTE: no & */

   		printf("If this incorrect press \"Y\" (Any key continue)");
   		response = getch();

   		while (response == 'Y' || response == 'y'){
   			printf("\nEnter last name: ");
   			gets(holdtext);
   			sscanf(holdtext,"%s",holdlast_name);	/* NOTE: no & */

   			printf("If this incorrect press \"Y\" (Any key continue)");
   			response = getch();
   		}
         found = 0;
         rewind(reguPtr);
         while ( (!feof(reguPtr)) && (found == 0) ) {
         	fread(&guest, sizeof(struct reserve), 1, reguPtr);
            if ((guest.last_name == holdlast_name) && (guest.guest_num == rooms.guest_num)){
               found = 1;

            	printf("\n\t\t Name Found\n "
            			 "\n\t\t Last name: %s"
                      "\n\t\t First name: %s"
                      "\n\t\t Full name: %s"
            			 "\n\t\t Length of stay: %d"
                      "\n\t Credit Card Number: %s",
                      guest.last_name, guest.first_name,
                      guest.full_name, guest.lenght_of_stay, guest.credit_card_num);

               if (guest.prefered_room_type == 0)
                   printf("\n\t\tRoom type: Smoking");

               if (guest.prefered_room_type == 1)
               	printf("\n\t\tRoom type: Non-Smoking");

               printf("\n\t\t Balance: %d"
                      "\n\t\t Guest's Number: %d",
                      guest.prefered_room_type, guest.balance, guest.guest_num);
            }
         }
         getch();
   }
}
开发者ID:nnation,项目名称:in-the-beginning-was-C,代码行数:66,代码来源:ssiproj.c


示例10: credits2

void credits2(void)
{
    int i, ch;
    int p;
    int plast = -1;
    clrscr();

    centerprint(aa_imgwidth(context) / 2, aa_imgheight(context) / 3, 3, 128, "The", 0);
    centerprint(aa_imgwidth(context) / 2, 2 * aa_imgheight(context) / 3, 3, 128, "END", 0);
    drawptr = decrand;
    params->randomval = 50;
    timestuff(0, NULL, draw, 5000000);
    drawptr = NULL;
    params->randomval = 0;
    drawptr = pryc;
    timestuff(0, NULL, draw, MAXTIME);
    drawptr = NULL;
    clrscr();
    draw();
    load_song("bb3.s3m");
    bbupdate();
    starttime = endtime = TIME;
    play();
    bbwait(1);
    for (i = 0; i < LOGOHEIGHT; i++) {
	aa_puts(context, aa_scrwidth(context) / 2 - 2, LOGOY + i, AA_BOLD, "8  8");
	if (i)
	    aa_puts(context, aa_scrwidth(context) / 2 - 2, LOGOY + i - 1, AA_NORMAL, "8  8");
	bbflushwait(100000);
    }
    aa_puts(context, aa_scrwidth(context) / 2 - 2, LOGOY + i - 1, AA_NORMAL, "8  8");

#define LWIDTH

    for (i = aa_scrwidth(context) / 2; i; i--) {
	display8();
	displaya(i);
	bbflushwait(10000);
    }
    for (; i < 100; i++) {
	textclrscr();
	displaya(10 * sin(i * M_PI / 100));
	display8();
	bbflushwait(10000);
    }
    aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_DIM, "<PROJECT><PROJECT>");
    bbflushwait(100000);
    aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_NORMAL, "<PROJECT><PROJECT>");
    bbflushwait(100000);
    aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_BOLD, "<PROJECT><PROJECT>");
    bbflushwait(100000);
    aa_puts(context, aa_scrwidth(context) / 2 - 9, LOGOY + 3, AA_NORMAL, "<PROJECT><PROJECT>");
    bbflushwait(100000);
    bbwait(1000000);
    for (i = LOGOY; i > 1; i--) {
	textclrscr();
	displogo(i);
	bbflushwait(30000);
    }

    source = malloc(aa_imgwidth(context) * (aa_imgheight(context)));
    target = malloc(aa_imgwidth(context) * (aa_imgheight(context)));
    params->dither = AA_NONE;
    format(dual ? aa_scrwidth(context) / 2 : aa_scrwidth(context));
    p = 0;
    while (1) {
	if (p != plast) {
	    getsource();
	    displaytext(p);
	    gettarget();
	    morph();
	    displaytext(p);
	    aa_flush(context);
        emscripten_sleep(1);
	    plast = p;
	}
      again:
    emscripten_sleep(100);
#ifndef __DJGPP__
	//ch = aa_getkey(context, 100);
    ch = AA_NONE;
#else
	while ((ch = bbupdate()) == AA_NONE) ;
#endif

	switch (ch) {
	case '1':
	    load_song("bb.s3m");
	    bbupdate();
	    play();
	    break;
	case '2':
	    load_song("bb2.s3m");
	    bbupdate();
	    play();
	    break;
	case '3':
	    load_song("bb3.s3m");
	    bbupdate();
	    play();
//.........这里部分代码省略.........
开发者ID:fourks,项目名称:bb.js,代码行数:101,代码来源:credits2.c


示例11: add_room_info

void add_room_info(FILE *reroPtr)
{
   int roomNum, response;
   struct room rooms = {0,0,0.00,0,0}; /* default information*/
   clrscr();
   printf("\t\t\tadd_room_info\n\n\n");

	printf("Enter room number(1 - 50): ");
	scanf("%d",&roomNum);
  	while (roomNum < 1 || roomNum > 50){
     	clrscr();
     	printf("\t\t\tadd_room_info\n\n\n");
     	printf("\aWrong Input!!!\n\n");
  		printf("Enter room number(1 - 50): ");
		scanf("%d",&roomNum);
  	}
	fseek(reroPtr,(roomNum-1)*sizeof(struct room),SEEK_SET);
	fread(&rooms,sizeof(struct room),1,reroPtr);

	if (rooms.room_num != 0){
  		printf("Room information already exist...");
     	Sleep(1000);
     	rewind(reroPtr);
      return;
  	}
  	else {
		printf("Room Type (Smoking \"0\" or Non-Smoking \"1\"): ");
		scanf("%d", &rooms.room_type);

		while (rooms.room_type != 0 && rooms.room_type != 1){
			printf("\n\aWrong Input!!!\n\n");
			printf("Room Type (Smoking \"0\" or Non-Smoking \"1\"): ");
			scanf("%d", &rooms.room_type);
		}/* end while*/
		if (rooms.room_type == 0){
			rooms.cost = 4000;
			printf("Room Cost: $%.2f\n", rooms.cost);
		}/* end if*/
		else{
			rooms.cost = 3000;
			printf("Room Cost: $%.2f\n", rooms.cost);
		}/* end else*/

		printf("Status (Available \"0\", Occupied \"1\", Rerserved \"2\"): ");
		scanf("%d", &rooms.status);
		while (rooms.status != 0 && rooms.status != 1 && rooms.status != 2){
			printf("\n\aWrong Input!!!\n\n");
			printf("Status (Available \"0\", Occupied \"1\", Rerserved \"2\"): ");
			scanf("%d", &rooms.status);
		}/* end while*/

    	printf("\nStill add this room? (Y\\N)");
     	response = getch();

		if ((response == 'N') || (response == 'n')) {
  			printf("\nDisregarding Input..."); Sleep(1000); printf("Discarded!");
        	Sleep(1000);
        	rewind(reroPtr);
         return;
  		}

     	rooms.room_num = roomNum;
      rooms.guest_num = 0; /* set room guest number to zero because it' available*/

		printf("\n\nPlease wait while data is being stored!\n");
     	Sleep(1000); printf(">>>>."); Sleep(1000); printf(">>>>."); Sleep(1000); printf(">>>>."); Sleep(1000);
     	/* Write data to file*/
   	//##################################################################################################################
     	fseek(reroPtr, (rooms.room_num - 1)*sizeof(struct room), SEEK_SET);
      fwrite(&rooms, sizeof(struct room), 1, reroPtr);
     	rewind(reroPtr);
      //##################################################################################################################
  		printf("\nSaved!");
     	Sleep(1000);
  	}
}
开发者ID:nnation,项目名称:in-the-beginning-was-C,代码行数:76,代码来源:ssiproj.c


示例12: main

int main (void)
#endif
{
    struct mouse_info info;
    struct mouse_box full_box, small_box;
    unsigned char width, height;
    char C;
    bool Invisible = true, Done = false, Jailed = false;

    /* Initialize the debugger */
    DbgInit (0);

    /* Set dark-on-light colors.  Clear the screen. */
#ifdef __CBM__
    (void) bordercolor (COLOR_GRAY2);
    (void) bgcolor (COLOR_WHITE);
    (void) textcolor (COLOR_GRAY1);
#else
    (void) bordercolor (COLOR_BLUE);
    (void) bgcolor (COLOR_WHITE);
    (void) textcolor (COLOR_BLACK);
#endif
    cursor (0);
    clrscr ();

    /* If a lightpen driver is installed, then it can get a calibration value
    ** from this file (if it exists).  Or, the user can adjust the pen; and,
    ** the value will be put into this file, for the next time.
    ** (Other drivers will ignore this.)
    */
#if defined(__C64__) || defined(__C128__) || defined(__CBM510__)
    pen_adjust ("pen.dat");
#endif

#if DYN_DRV
    /* If a dynamically loadable driver is named on the command line,
    ** then use that driver instead of the standard one.
    */
    if (argc > 1) {
        mouse_name = argv[1];
    } else {
        /* Output a warning about the standard driver that is needed. */
        DoWarning ();
        mouse_name = mouse_stddrv;
    }

    /* Load and install the driver. */
    CheckError ("mouse_load_driver",
                mouse_load_driver (&mouse_def_callbacks, mouse_name));
#else
    /* Install the driver. */
    CheckError ("mouse_install",
                mouse_install (&mouse_def_callbacks,
#  ifdef MOUSE_DRIVER
                               MOUSE_DRIVER
#  else
                               mouse_static_stddrv
#  endif
                               ));
#endif

    /* Get the initial bounding box. */
    mouse_getbox (&full_box);

    screensize (&width, &height);

top:
    clrscr ();

    /* Print a help line */
    cputs (" d)ebug  h)ide   q)uit   s)how   j)ail");

    /* Put a cross at the center of the screen. */
    gotoxy (width / 2 - 3, height / 2 - 1);
#if defined(__CBM__)
    cprintf ("%3u,%3u\r\n%*s\xDB", width / 2 * 8 + 4, height / 2 * 8 + 4,
             width / 2, "");
#else
    cprintf ("%3u,%3u\r\n%*s+", width / 2 * 8 + 4, height / 2 * 8 + 4,
             width / 2, "");
#endif

    /* Test loop */
    ShowState (Jailed, Invisible);
    do {
        /* Get the current co-ordinates and button states; and, print them. */
        mouse_info (&info);
        gotoxy (0, 2);
        cprintf (" X  = %3d\r\n", info.pos.x);
        cprintf (" Y  = %3d\r\n", info.pos.y);
        cprintf (" B1 = %c\r\n", (info.buttons & MOUSE_BTN_LEFT) ?
#ifdef __CBM__
                 0x5F
#else
                 'v'
#endif
                 : '^');
        cprintf (" B2 = %c", (info.buttons & MOUSE_BTN_RIGHT) ?
#ifdef __CBM__
                 0x5F
//.........这里部分代码省略.........
开发者ID:FelipeBudinich,项目名称:cc65,代码行数:101,代码来源:mousetest.c


示例13: file_selector

int file_selector(char *result) {
//	SDL_Event ev;
    u32 keys; 
	int picked = 0;
//	int max_width = tiawidth/FONT_WIDTH;
	int max_height = MaxLines/FONT_HEIGHT; //-1;
	int k = 0;

	if (PaletteNumber != UserPaletteNumber)
	{
		PaletteNumber = UserPaletteNumber;
		gui_SetVideoMode();
	}
	clrscr();

	/* filesread is a global that gets updated by get_list */
	if (first_filelist) 
	{
		get_file_list();
		first_filelist = 0;
	}

	while(hidKeysHeld()) hidScanInput(); //wait for previous keys to be released

	while(!picked) {
		int action;

		window_line = draw_file_list(curfile, window_line, max_height-2);
//		SDL_WaitEvent(&ev);	
		hidScanInput();
		while(!hidKeysHeld()) hidScanInput();
		keys = hidKeysHeld();
		
		action = gui_navigation(keys); //&ev);

		if(action == GUI_NO_ACTION)
			continue;

		switch(action) 
		{
		char type;

		case GUI_EXIT_GUI:
			clrscr();
			return 0; /* abort */

		case GUI_ACTIVATE_SEC:
			match = 0;
			curfile++;
			if(curfile == filesread) curfile = 0;
			clrscr();
			type = file_list[curfile][strlen(file_list[curfile])-1];
			if(type == '/')	/* if it's a dir, cd to it and get new file list. */
			{
				if (chdir(file_list[curfile]) == 0)
				{
					curfile = 0;
					get_file_list();
				}
			} 
			else		/* if it's a file, return it */
			{
				strcpy(result, file_list[curfile]);
				picked = 1;
			}
			break;
		
		
		case GUI_ACTIVATE_PRI:
			match = 0;
			clrscr();
			type = file_list[curfile][strlen(file_list[curfile])-1];
			if(type == '/')	/* if it's a dir, cd to it and get new file list. */
			{
				if (chdir(file_list[curfile]) == 0)
				{
					curfile = 0;
					get_file_list();
				}
			} 
			else		/* if it's a file, return it */
			{
				strcpy(result, file_list[curfile]);
				picked = 1;
			}
			break;

		case GUI_UP:
			match = 0;
			curfile--;
			if(curfile < 0) curfile = filesread - 1;
			break;

		case GUI_DOWN:
			match = 0;
			curfile++;
			if(curfile == filesread) curfile = 0;
			break;

		case GUI_PAGEDOWN:
//.........这里部分代码省略.........
开发者ID:nop90,项目名称:z26-3ds,代码行数:101,代码来源:guifilelist.c


示例14: display_chars

void display_chars(int off,int off2,int places[25])
{
	int a,b,places_c,x=3,y=12;

	clrscr();
	display();

/* -----------------------------------------
	 Display loop
	 -----------------------------------------------------------------------*/
	for (places_c=0;places_c<=23;places_c++) {
		b=0;
		gotoxy(x,y);
		if  (y==12)
			  a=0;
		else a=1;
		if  (places[places_c]<0)
			  disp_o(a,places,places_c);
		if  (places[places_c]>0)
			  disp_x(a,places,places_c);

		if ((x==18 && y==3) || (x==45 && y==3)) {
			x-=3;
			b=2;
		}
		if (x==30 && y==12) {
			x+=3;
			b=2;
		}
		if (x!=18 && x!=45 && x!=30 && b!=2) {
			if (y==12)
				x+=3;
			if (y==3)
				x-=3;
			b=1;
		}
		if (x==18 && y==12 && !b)
			x+=12;
		if (x==45 && y==12 && !b)
			y=3;
		if (x==30 && y==3 && !b)
			x-=12;
	}

/* -----------------------------------------
	 Bar calculations
	 -----------------------------------------------------------------------*/
	if (places[24]!=0)
		bar_xo(places);

/* -----------------------------------------
	 Bear-off calculations
	 -----------------------------------------------------------------------*/
	if (off>0) {
		gotoxy(50,1);
		cout << "X-off = " << off;
	}
	if (off2>0) {
		gotoxy(50,3);
		cout << "O-off = " << off2;
	}
}
开发者ID:dakahler,项目名称:backgammon,代码行数:62,代码来源:DISPCHAR.C


示例15: main

int main(int argc, char **argv)
{
    I16 card, err;
    U16 card_num;
    U16 GCtr;
    U16 Mode = x4_AB_Phase_Encoder;
    U16 SrcCtrl = 0; //Not used in encoder
    U16 PolCtrl = 0; //Not used in encoder
    U32 LReg1_Val = 0; //Not used in encoder
    U32 LReg2_Val = 0; //Not used in encoder
    U32 RD_Value;
    int i = 0;

    printf("This sample performs x4 AB phase mode.\n");
    printf("Card Number? ");
    scanf(" %hd", &card_num);

    card = Register_Card(PCI_9222, card_num);
    if(card<0){
        printf("Register_Card Error: %d\n", card);
        exit(1);
    }

    printf("Encoder Number? ");
    scanf(" %hd", &GCtr);
    GCtr = (GCtr==1)? P922x_ENCODER1:P922x_ENCODER0;

    /*Clear Encoder*/
    err = GPTC_Clear(card, GCtr);
    if(err<0){
        printf("GPTC_Clear Error: %d\n", err);
        goto ERR_RET;
    }

    /*Setup Encoder*/
    err = GPTC_Setup(card, GCtr, Mode, SrcCtrl, PolCtrl, LReg1_Val, LReg2_Val);
    if(err<0){
        printf("GPTC_Setup Error: %d\n", err);
        goto ERR_RET;
    }

    /*Enable Encoder*/
    printf("Press any key to enable counter...\n");
    getch();
    err = GPTC_Control(card, GCtr, IntENABLE, 1);
    if(err<0){
        printf("GPTC_Control(IntENABLE) Error: %d\n", err);
        goto ERR_RET;
    }

    do{
        /*Read Encoder*/
        err = GPTC_Read(card, GCtr, &RD_Value);
        if(err<0){
            printf("GPTC_Read Error: %d\n", err);
            goto ERR_RET2;
        }
        clrscr();
        printf("/*---------------------------------*/\n");
        printf(" Encoder Number: %d\n", GCtr-4);
        printf(" Read Count: %d\n\n", RD_Value);
        printf("      You can press Enter to stop...\n");
        printf("/*---------------------------------*/\n");
        usleep(1000);
    }while(!kbhit());

ERR_RET2:
    GPTC_Control(card, GCtr, IntENABLE, 0);
ERR_RET:
    GPTC_Clear(card, GCtr);
    Release_Card(card);

    printf("\nPress any key to exit...\n");
    getch();
    return 0;
}
开发者ID:ellysh,项目名称:pci-dask,代码行数:76,代码来源:9222ecd.c


示例16: report_smoke_nonsmoke

void report_smoke_nonsmoke(FILE *reroPtr)
{
	FILE *report1;  /* Create file report of available smoking and
   						non-smoking rooms for printing */
   int found;
   struct room rooms = { 0, 0, 0.00, 0, 0}; /* default room information*/
   clrscr();
   printf("\t\t\treport_smoke_nonsmoke\n\n\n");

   if( (report1 = fopen("Available Smoking and Non-smoking rooms.txt", "w") ) ==
   	NULL){
   	printf("\aRoom file could not be found.\n\n"
      		 "Press any to EXIT!");
      getch();
   }
   else {
   							/*Print to screen*/
      printf("NB: Room Type (Smoking \"0\" or Non-Smoking \"1\")\n"
      		 "    Room Status (Available \"0\", Occupied \"1\", Rerserved \"2\")\n"
             "    Room Guest Number \"0\", No guest, hence equal zero.\n\n\n");
                       /*Write to file*/
      fprintf(report1,"%s\n%s\n%s\n\n\n","NB: Room Type (Smoking \"0\" or Non-Smoking \"1\")",
      		 "    Room Status (Available \"0\", Occupied \"1\", Rerserved \"2\")",
             "    Room Guest Number \"0\", No guest, hence equal zero.");
                        /*Print to screen*/
      printf("%-12s%-2s%-10s%-2s%-10s%-2s%-12s%-2s%-17s\n",
            		"Room Number","|","Room Type","|","Room Cost","|","Room Status","|","Room Guest Number");
                        /*Write to file*/
      fprintf(report1,"%-12s%-2s%-10s%-2s%-10s%-2s%-12s%-2s%-17s\n",
            		"Room Number","|","Room Type","|","Room Cost","|","Room Status","|","Room Guest Number");
      found = 0;
      rewind(reroPtr);
   	while ( (!feof(reroPtr)) && (found == 0) ){
      	fread(&rooms, sizeof(struct room), 1, reroPtr);
         if ((rooms.room_num > 0) && (rooms.status == 0)){
                       /*Print to screen*/
         	printf("%-12d%-12s%-12s%-14s%-19s\n",rooms.room_num, rooms.room_type, rooms.cost,
   				rooms.status, rooms.guest_num);
                       /*Write to file*/
         	fprintf(report1,"%-12d%-12s%-12s%-14s%-19s\n",rooms.room_num, rooms.room_type, rooms.cost,
   				rooms.status, rooms.guest_num);
            found = 1;
         }
      }
      if(found == 0) {
   		printf("\n\n\n\aNo Rooms are Available!");
         fprintf(report1,"\n\n\n%s","No Rooms are Available!");
         Sleep(1000);
      }
      else {
      	printf("\n\nPlease wait while data is being stored to report file!\n");
			Sleep(1000); printf(">>>>."); Sleep(1000); printf(">>>>."); Sleep(1000); printf(">>>>."); Sleep(1000);
         printf("Stored!\n\nData is stored in a file called \"Available Smoking and Non-smoking rooms\"");

         printf("\nPress Any Key...Main Menu!");
         getch();
      }

   }
   fclose(report1);
}
开发者ID:nnation,项目名称:in-the-beginning-was-C,代码行数:61,代码来源:ssiproj.c


示例17: main

void main()
{
	clrscr();
	int s_on=1,speed=50,quit=0,s,p2y=12,ballx=11,bally=3,p1y=12,bxdir=1,bydir=1,p2dir=0,p1dir=0, p2score=0,p1score=0;
	char choice;
	gotoxy(30,12);
	cout << "Chops's Pong";
	getch();
	help();
	clrscr();
	do
	{
		do
		{
		// Write scores
		gotoxy(1,1);
		cout << p2score;
		gotoxy(75,1);
		cout << p1score;



		//clear paddle
		gotoxy(10,p2y+0); cout << " ";
		gotoxy(10,p2y+1); cout << " ";
		gotoxy(10,p2y+2); cout << " ";
		gotoxy(10,p2y+3); cout << " ";

		gotoxy(70,p1y+0); cout << " ";
		gotoxy(70,p1y+1); cout << " ";
		gotoxy(70,p1y+2); cout << " ";
		gotoxy(70,p1y+3); cout << " ";
		// Draw 2p paddle
		if(p2y==21 || p2y==1) p2dir=0;
		if(p1y==21 || p1y==1) p1dir=0;
		if(p2dir==1)
		{
			p2y++;
			if(p2y>=21) p2y=20;
		}
		if(p2dir==-1)
		{
			p2y--;
			if(p2y<=1) p2y=2;
		}
		if(p1dir==1)
		{
			p1y++;
			if(p1y>=21) p1y=20;
		}
		if(p1dir==-1)
		{
			p1y--;
			if(p1y<=1) p1y=2;
		}
		gotoxy(10,p2y+0); cout << &quo 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ clrsetbits_be32函数代码示例发布时间:2022-05-30
下一篇:
C++ clrbits_le32函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap