Thread: Expected error

  1. #1
    ___
    Join Date
    Jun 2003
    Posts
    806

    Expected error

    *edited everything clean so I can post my new problem hehe.
    Last edited by ZakkWylde969; 06-16-2003 at 07:44 PM.
    "When I die I want to pass peacefully in my sleep like my grandfather did, not screaming and yelling like the passengers in his car."

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >>y=ROWS//2;

    You have an extra slash there.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    ___
    Join Date
    Jun 2003
    Posts
    806
    Thanks.
    "When I die I want to pass peacefully in my sleep like my grandfather did, not screaming and yelling like the passengers in his car."

  4. #4
    ___
    Join Date
    Jun 2003
    Posts
    806
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include <dos.h>
    
    #define FACE 0x08				//Face Character number
    #define BLANKSPACE 0x08	                	//Backspace charactor
    #define BLANK 0x20				//Blacnk character number
    #define LOOP 100				//number of faces to dispay
    #define PAUSE 150000				//pause time (0-16,000,000)
    #define VIDEO 0x10				//video interrupt
    #define COLS 80					//screen width
    #define ROWS 25					//Screen rows
    
    void cls(void);
    void locate(int col , int row);
    int rnd(int range);
    void main ()
    {
    	int t,x,y;			
    	unsigned long p;			//p=pause loop
    
    	cls();					//clear the screen
    	seedrnd();				//set randomizer
    
    						// start at the center of the screen
    	x=COLS/2;				//half screen width
    	y=ROWS/2;				//half screen hight
    
    						//move the drunk LOOP number of times
    	for (t=0;t<LOOP;t++)
    	{
    		locate(x.y);			//move cursor
    		putchar(FACE);			//be happy
    		for(p=0;p<PAUSE;p++);		//pause
    
    						/*
    						SCript above moves the drunk dude RYCHER 
    						all around. it will be funny
    						*/
    		x+=(rnd(3)-1);			//new random x
    		y+=(rnd(3)-1);			//new random y
    
    						/*These next things make sure RYCHER 
    						doesnt float off the screen on accident
    						*/
    
    		if(x<1) x=80;			//wrap left
    		if(x>80) x=1;			//wrap right
    		if(x<1) y=25;			//wrap to the bottom
    		if(x>25) y=1;			//wrap top
    
    						/*This part next will make him 
    						appear back in the middle
    						*/
    
    		putchar(BACKSPACE);		//back up
    		putchar(BLANK);			//and erace the drunk
    	}
    }
    
    
    void cls(void)
    {
    	union REDS reds;
    
    	regs.h.ah=0x06;				//call function 6, scroll window
    	regs.h.al=0.x00;			//clear screen
    	regs.h.bh=0x07;				//make screen blank color
    	regs.h.ch=0x00;				//upper left row
    	regs.h.cl=0x00;				//upper left column
    	regs.h.dh=ROWS-1;			//lower right roow
    	regs.h.dl=cols-1;			//lower right column
    	int86(VIDEO,&regs,&regs);
    
    	locate(0,0);				//Home the cursor
    }
    
    
    void locate(int col,int row)
    {
    	union REGS regs;
    
    	regs.h.ah=0x02;				//video function 2, move the cursor
    	regs.h.bh=0x00;				//videos screen which is always 0
    	regs.h.dh=row;				//cursors column position
    	regs.h.dl=col:				//cursors row position
    	int86(VIDEO,&regs,&regs);
    
    }
    int rnd(int range)
    {
    	int r;
    
    	r=rand()%range;				//split up a random number
    }	
    
    void seedrnd(void)
    {
    	srand((unsigned)time(NULL);
    }
    And here is my Compile error. the problem is is that it is saying there is a problem with text that isnt there.

    Code:
    Miracle C Compiler (r3.2), written by bts.
    line   4: #include dos.h ignored--file not found.
    Compiling c:\documents and settings\justin\desktop\compiled files\drunkdude.c
    main
    
    c:\documents and settings\justin\desktop\compiled files\drunkdude.c: line 36: bad . ref
    '{ locate(x.y)'
    aborting compile
    Why is it missing the dos.h file? And why am I having wrong code in blank space. Man this stuff is annoying.
    "When I die I want to pass peacefully in my sleep like my grandfather did, not screaming and yelling like the passengers in his car."

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    >>locate(x.y)
    You should have a comma, not a period.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  6. #6
    ___
    Join Date
    Jun 2003
    Posts
    806
    Code:
    unrecognised types in comparison 'for(p=0'
    thats the new compiler error.

    Im really trying not to be too much of a pain in the ass but this is really confusing me. Its talking about the pause part i presume. Ugh what a pain.
    "When I die I want to pass peacefully in my sleep like my grandfather did, not screaming and yelling like the passengers in his car."

  7. #7
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    You might run into problems using this program on OSes such as Win2k, NT, or XP (?). You *might* consider an older dos compiler since one will have the functions that you're using int86 on now, and it will have dos.h.

    You can download the relic Turbo C for free, but you must register first. Look in the museum afterwards.

    pause may be the problem since you also have stdlib included. Try renaming that. I'd use a delay function from time.h instead of a loop since the loop will run at different speeds depending on the speed of the user's processor.

    HTH
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

  8. #8
    ___
    Join Date
    Jun 2003
    Posts
    806
    Actually I am teaching myself over the summer and I picked up an old C book and flipped through it. (C for Dummies Vol one.) They have some sourse code in the back and I just entered it into one because it looked cool. But Ill get a different compiler too.
    "When I die I want to pass peacefully in my sleep like my grandfather did, not screaming and yelling like the passengers in his car."

  9. #9
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>*edited everything clean so I can post my new problem hehe.<<
    Err, please don't delete posts that are relevant to the thread unless you really have to. Other people learn from your questions too, or at least, they would if they can read them
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  10. #10
    ___
    Join Date
    Jun 2003
    Posts
    806
    Originally posted by Hammer
    >>*edited everything clean so I can post my new problem hehe.<<
    Err, please don't delete posts that are relevant to the thread unless you really have to. Other people learn from your questions too, or at least, they would if they can read them
    Ok. Sorry about that I just didnt want to put too much code onto this thread and make it confusing.
    "When I die I want to pass peacefully in my sleep like my grandfather did, not screaming and yelling like the passengers in his car."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  3. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  4. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  5. Windows using Dev-C++
    By Renegade in forum C++ Programming
    Replies: 15
    Last Post: 07-07-2005, 08:29 PM