Thread: --> Compiling Problems -->

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    --> Compiling Problems -->

    wonder if you can help, im trying to compile this piece of code..

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    int main()
    {
    	int n, r;
    	double s, spike;	
    	
    	n = 0								
    	r = rand()*40/RAND_MAX + 10;		
    	
    	while (scanf ("%lg", &s) !=EOF)
    
    	{
    		if (n == r)
    
    		{
    			spike = (double)rand() *30.0 / RAND_MAX - 15.0;		
    			printf ("%lg\n", spike);	
    			n = 0;				
    			r= rand()*40/RAND_MAX + 10;
    		}
    	
    		else
    
    		{
    			printf("%lg\n",s)
    			n = n+1;
    		
    		}
    	}
    }
    im getting the following errors:
    line 12: error 1000: unexpected symbol: "r"
    line 30: error 1000: unexpected symbol: "n"
    error 1764: declarations as statements only with ansi_extend option.

    its probably a really easy problem to fix but im very new to C!

    any help appreciated

  2. #2
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680
    > n = 0;

    > printf("%lg\n",s);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem Compiling
    By Flakster in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2006, 01:09 AM
  2. Linking problems, class problems
    By Kheila in forum C++ Programming
    Replies: 12
    Last Post: 11-22-2005, 01:47 AM
  3. compiling problems LNK2019 error
    By sugie in forum C++ Programming
    Replies: 2
    Last Post: 10-19-2005, 05:25 PM
  4. Compiling Problems...
    By Hydro in forum C++ Programming
    Replies: 2
    Last Post: 01-23-2002, 06:49 PM