Thread: Faster Way?

  1. #1
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77

    Lightbulb Faster Way?

    hey.

    I am curious if there is a more efficient way to produce the effect that i am working with, or if this is the easiest (no it's not complex, i just started learning C this semester);


    Code:
    #include <stdio.h>
    #include <windows.h>
    
    void main()
    {
    	int x=219,y=0,Current;
    	char Complete[] = "* complete *";
    
    	printf("\n\n\t.now.loading.the.encryption.\n");
    	printf("\n\t      [............]");
    	printf("\b\b\b\b\b\b\b\b\b\b\b\b\b");
    
    	
    		while (y<12) {
    			printf("%c",x);
    			if (y%2==0) {
    				Sleep(120);      }
    
    			if (y%4==0) {
    				Sleep(900);      }
    			
    			else {
    				Sleep(400);      }
    			
    			y=(y+1);	                         }
    
    		y=0; x=0;
    		printf("\n\t       ");
    
    		while (y<13) {
    			Current = Complete[x];		
    			Sleep(75);
    			printf("%c",Current);
    			x=(x+1);
    			y=(y+1);             }
    		
    		printf("\n\n\n\n\n");
    }

    Another - Can anyone explain what C# Programming is?

    Final - How do you get Windows to recognize the entire-255 ASCII character set, instead of just the natural 128 or whatever?

    Thanks.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I am curious if there is a more efficient way to produce the effect that i am working with
    Well, if you want the bar to move slowly enough so that the user can see the movement or for a long enough time to complete the action being performed then there's really no need to be efficient. The status bar will be complete when whatever is being done is also complete, so it's dependent on how you use it. I did toy around with it and you may like this effect a bit better
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <windows.h>
    
    int main(void)
    {
    	int x = 219,y = 0;
    	const char *Complete = "* complete *";
    
    	printf("\n\n\tEncryption in progress, please wait\n");
    	printf("\n\t          [............]");
    	printf("\b\b\b\b\b\b\b\b\b\b\b\b\b");
    	
    	while (y < 12) {
    		printf("%c", x);
    		if (y % 2 == 0)
    			Sleep(120);
    		else if (y % 4 == 0)
    			Sleep(900);
    		else
    			Sleep(400);
    		y = (y + 1);
    	}
    	y = 0; x = 0;
    	printf("\b\b\b\b\b\b\b\b\b\b\b\b");
    	printf("%s\n\n", Complete);
    
    	return EXIT_SUCCESS;
    }
    >Can anyone explain what C# Programming is?
    C# is Java with all of the names changed from what I've seen.

    >How do you get Windows to recognize the entire-255 ASCII character set
    I wasn't aware that Windows didn't recognize the entire set.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    Originally posted by Prelude

    C# is Java with all of the names changed from what I've seen.
    Yeah Microsoft can take C# and shove it up their ass for all I care.

  4. #4
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    brian, just a quick question, have you ever used C#? No? Thought not...then don't badmouth it.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    I don't see why we can't spare C# the humiliation... as long as we use something sharp.

    Really, there are reasons for wanting Microsoft products to fail in general. Too many patent lawers... it's like the second coming of IBM.
    Callou collei we'll code the way
    Of prime numbers and pings!

  6. #6
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    Get a job. It's a fact of life that you can't pirate software anymore. Too bad for you. Good for me!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Faster bitwise operator
    By Yarin in forum C++ Programming
    Replies: 18
    Last Post: 04-29-2009, 01:56 PM
  2. Faster way of printing to the screen
    By cacophonix in forum C Programming
    Replies: 16
    Last Post: 02-04-2009, 01:18 PM
  3. Which Operation is Faster "=" or "+=" ?
    By thetinman in forum C++ Programming
    Replies: 37
    Last Post: 06-06-2007, 07:29 PM
  4. does const make functions faster?
    By MathFan in forum C++ Programming
    Replies: 7
    Last Post: 04-25-2005, 09:03 AM
  5. Floating point faster than fixed-point
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 11-08-2001, 11:34 PM