Thread: i can't figure this out

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    26

    i can't figure this out

    my game is 99.9 % complete and now i have a prob using cin.
    i just need to prompt the user for their name for high score, but when i use cin, nothing happens in my program. i compiles right. what is wrong. I am using allegro, and it is a win32 app, not console. can anyone help. thanks
    jesse

  2. #2
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Sure, I'll use my telepathic abilities to read your code and find the error.

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    26
    i could post the whole code, but it prolly wouldn't help, i will put a piece of it up..

    Code:
    char player_name[30];
    
    void sort_high_scores(void)
    {
    	int i;
    	int score = snake_size + 1;
    	int score_rank = -1;
    
    
    	for (i=0;i<=9;i++)
    	{
    		if (score >= high_score[i])		{
    			score_rank = i;
    			break;
    		}
    	}
    	if (score_rank >= 0) 
    	{
    
    
    
    		cin >> player_name;
    
    
    
    
    		for (i=9;i>score_rank;i--)
    		{
    			high_score[i] = high_score[i-1];
    			strncpy(high_score_name[i],      
    high_score_name[i-1], 30);
    		} 
    	high_score[score_rank] = score;
    
    	}
    	return;
    }
    if tried putting the cin in other parts of my code, but still nothing happens. like i said it does however compile and run. just never prompts the user for there name like it should.

  4. #4
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469

    Talking

    LOL, yea, the code would help.
    And, the code tag is in the []
    ex

    Code:
    I used the code brackets to write this

  5. #5
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    wait, you say your using the win32 API?

  6. #6
    Registered User
    Join Date
    Feb 2002
    Posts
    26
    no im not programming w/ win32 api, i don't know that yet, but when i started i selected win32 app in msvc++ 6.

  7. #7
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    oh, so you're really using allegro?

  8. #8
    Registered User
    Join Date
    Feb 2002
    Posts
    26
    yes im using allegro for my gfx and other things. And im not a complete dumb ass, im just a little comfused.

  9. #9
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    Originally posted by m00se123
    yes im using allegro for my gfx and other things. And im not a complete dumb ass, im just a little comfused.
    That's why you can't spell confused. I don't much about Allegro. Couldn't you just have a dialog box with a text box in it?

  10. #10
    Registered User
    Join Date
    Feb 2002
    Posts
    26
    so i can't just us cin, why not?

  11. #11
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    I'm not sure but I think cin is only in console.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 3 dimensional figure volume
    By thekautz in forum C++ Programming
    Replies: 2
    Last Post: 01-20-2009, 05:22 PM
  2. trying to figure out someone's code for a plugin
    By paulpars in forum C++ Programming
    Replies: 4
    Last Post: 07-20-2006, 10:57 AM
  3. newb to C, cant figure something out.
    By Phate4219 in forum C Programming
    Replies: 16
    Last Post: 03-06-2006, 01:47 AM
  4. My library is failing and I cannot figure out why...
    By DerelictDream in forum C++ Programming
    Replies: 7
    Last Post: 08-15-2005, 03:47 PM
  5. Can't figure out strcmp error
    By Fyodorox in forum C++ Programming
    Replies: 10
    Last Post: 05-08-2002, 10:18 AM