Some help using Code::blocks !

This is a discussion on Some help using Code::blocks ! within the C Programming forums, part of the General Programming Boards category; I'm writing a code in C to solve partial differential 2D heat equations through Gauss-Seidel Iterations. I was using TurboC++ ...

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    2

    Some help using Code::blocks !

    I'm writing a code in C to solve partial differential 2D heat equations through Gauss-Seidel Iterations. I was using TurboC++ to compile and the program ran perfectly, but when I switched to Code::Blocks and compiled and ran the program, all I get is a black screen. I'm a beginner in C programming and can't figure out why I'm not getting any output on the screen. Any help would be greatly appreciated!
    I have written the following code :
    Code:
    #include <stdio.h>
     int i,j,imax=21,jmax=41,n=0;
     float dx=0.05,dy=0.05,T1=150,T2=0,T3=0,T4=0,error,error_max=0.01,T_o ld,T[22][42];
      /*Initialization of T at interior points*/
         for(i=1;i<=imax;i++)
         for(j=1;j<=jmax;j++)
         T[i][j]=0;
      /*T at boundary points*/
         for(j=1;j<=jmax;j++)
          { T[1][j]=T2;
             T[imax][j]=T4;
           }
         for(i=1;i<=imax;i++)
          { T[i][1]=T1;
            T[i][jmax]=T3;
          }
    
        /*Gauss-Seidel Iterations*/
       { error=0;n++;
          for(i=2;i<imax;i++) 
          { for(j=2;j<jmax;j++)
            { T_old=T[i][j];
               T[i][j]=(dy*dy*(T[i+1][j]+T[i-1][j])+dx*dx*(T[i][j+1]+T[i][j-1]))/(2*(dx*dx+dy*dy));
                 if(T_old>T[i][j])
                  error=error+(T_old-T[i][j]);
                 else
                  error=error+(T[i][j]-T_old);
             }
          }
        }while(error>error_max);
    
       /*results*/
         printf("i \t j \t T (Gauss-Seidel)");
           for(j=1;j<=jmax;j++)
         printf("\n 11 \t %d \t %f",j,T[11][j]);
         printf("\n error = %f,\n n = %d", error,n);

  2. #2
    Registered User
    Join Date
    Jun 2012
    Posts
    2
    I'v found my mistake.. Please ignore the post.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. code::blocks
    By wart101 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-18-2007, 06:42 AM
  2. code::blocks
    By wart101 in forum Tech Board
    Replies: 4
    Last Post: 01-15-2007, 06:38 AM
  3. MS code::blocks
    By wart101 in forum C++ Programming
    Replies: 11
    Last Post: 12-14-2006, 10:59 AM
  4. Dev and Code Blocks
    By swgh in forum Game Programming
    Replies: 3
    Last Post: 04-07-2006, 07:21 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21