# Compilers For C And C++ ?



## clmlbx (Dec 11, 2007)

OK GUYS, I just joined aptech for c & c++. now to complete my assignment i need a compiler .( which is light and of complete use ). I installed microsoft c++ express edition ..but how to use it ............u sudgest me good compiler or tell me how to use that c++ express edition from microsoft .


----------



## The_Devil_Himself (Dec 11, 2007)

forget it.Download devc++,its easy to use and lightweight.And I suggest you try out Linux for your programming needs.


----------



## clmlbx (Dec 11, 2007)

#include <conio.h>
#include <stdio.h>
void main()
{
     clrscr();
     printf("asssignment 1");
     getch();
     }

is there any thing wrong in it  ?

I am getting 3 errors


----------



## The_Devil_Himself (Dec 11, 2007)

which compiler?

Lemme guess the errors:
1.conio.h is not defined something
2.error about clrscr()
3.getch()

conio.h is not a part of standard ISO c\c++ standards.and both clrscr and getch are defined in conio.h.


----------



## QwertyManiac (Dec 11, 2007)

Yeah just omit conio.h, clrscr(); and getch();


```
#include <stdio.h>
int main()
{
printf("asssignment 1");
}
```


----------



## clmlbx (Dec 11, 2007)

in dev c++

'main' must return int

In function `int main(...)':

`clrscr' undeclared (first use this function)


----------



## QwertyManiac (Dec 11, 2007)

Use the above given code sample.


----------



## clmlbx (Dec 11, 2007)

ok that is working but for other programes 

wont it make any problem

so conio.h will not work in dev c++

any other compiler


----------



## The_Devil_Himself (Dec 11, 2007)

^^was this code told to you by your teachers?Or you just made it yourself?Which book are you using?


forget this compiler ratting devc++ is very good.


Programming in standard c\c++


----------



## QwertyManiac (Dec 11, 2007)

clmlbx said:
			
		

> so conio.h will not work in dev c++


conio.h is not standard C. Its a part of dinosaur C which devs back in 80s probably used.


----------



## clmlbx (Dec 11, 2007)

this was told by my teacher

books are provided by aptech


----------



## QwertyManiac (Dec 11, 2007)

Sigh, get Turbo C++ from your college/school/windows_users_at_digit and go on, be a part of the unproductive coders.


----------



## clmlbx (Dec 11, 2007)

in turbo c++ also i have three errors


----------



## The_Devil_Himself (Dec 11, 2007)

^^then tell your bloody teachers to teach you standard c\c++.OR just forget them all and learn yourself.

There are thousands of good tutorials available on net to get you started.


----------



## Pathik (Dec 11, 2007)

@clmblx Ur teacher doesnt use dev c++ then .. 
btw for the return error add a 
return 0;
before the code ends..


----------



## clmlbx (Dec 11, 2007)

i remember he uses turbo c++

in turbo c++ errors are

include conio.h and stdio.h can not be open

unable to create .obj file


----------



## The_Devil_Himself (Dec 11, 2007)

turbo c++ was last launched in 1992!!! and c\c++ was standardized in 1998 iirc.

what aptech\your teachers are teaching you is not standars c\c++ which all the devs around the world use.


@errors in turbo c++:you have to specify the directry of header files in some setting iirc.Dude trust us and stop using turbo.


----------



## clmlbx (Dec 11, 2007)

any help or hint for

how to write programme for even and odd 

greater in 3 numbers using switch


----------



## The_Devil_Himself (Dec 11, 2007)

^^lol.we can't teach you every program boy.Make good use of your net connection.

anyways how to check for even,odd:

let the no. to be tested is n,then if n%2==0 then the no. n is even otherwise not.

%=remiander,i.e. for e.g. 5%2=1,7%5=2,4%2=0.
'==' duble = means comparision.


----------



## clmlbx (Dec 11, 2007)

i knew how to do it but i was little confused ..

hey any one know why i am getting that errors in turbo c++

(post no. 16)


----------



## mehulved (Dec 12, 2007)

QwertyManiac said:
			
		

> Yeah just omit conio.h, clrscr(); and getch();
> 
> 
> ```
> ...


Shouldn't it be returning an int?
I believe you should either add 

```
return 0
```
or 

```
main
```
 instead of int main.
Though this won't give an error but I believe it should give warning if you pass -Wall parameter to gcc.

Didn't I warn of the morons at aptech? Forget aptech they will teach you just crap.


----------



## Yamaraj (Dec 12, 2007)

```
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    (void) printf("asssignment 1");

    return EXIT_SUCCESS;
}
```
This code conforms to the ANSI/ISO C standards, and can withstand all syntax checker programs (lint), as well as -Wall -ansi -pedantic parameters to the GCC C compiler.


----------



## Zeeshan Quireshi (Dec 14, 2007)

clmlbx said:
			
		

> in turbo c++ also i have three errors



Here , this is the solution for you:

*www.thinkdigit.com/forum/showthread.php?t=65520


----------



## clmlbx (Dec 15, 2007)

^^^ I got the solution .. It was directory errors. directories were not defined correctly

thanx


----------



## sudhir_mangla (Jan 25, 2008)

visual studio 2008 express edition Just give it a try your search would be over.


----------



## The Conqueror (Jan 25, 2008)

Also bloodshed dev c++ is good 
visual studio 08 roxx


----------



## anand1 (Jan 25, 2008)

Yes go for DevC++ i have been using it and never had any problem. It is light and eats up less memory.


----------



## nileshgr (Jan 25, 2008)

you want clear screen. use the following code:


```
#include <stdio.h>
#include <stdlib.h>

void clrscr()
{
system("clear");
}

int main()
{
clrscr();
printf("asssignment 1\n\n");
}
```

I have tried this using g++ but i can't guarantee that it will work on Windows.


----------



## khattam_ (Jan 25, 2008)

clmlbx said:


> i knew how to do it but i was little confused ..
> 
> hey any one know why i am getting that errors in turbo c++
> 
> (post no. 16)



turbo c++ shows error details... on compiling..... Ctrl+F9

like this:
*geocities.com/khattam_khattam/tcerr1.jpg

and when you press enter, it shows:
*geocities.com/khattam_khattam/tcerr2.jpg

post the details here, if you cant figure out urself......


----------



## Zeeshan Quireshi (Jan 25, 2008)

anand1 said:


> Yes go for DevC++ i have been using it and never had any problem. It is light and eats up less memory.


Man VC++ 2008 Express Edition pwns DevC++ , just have a look at it n then tell .


----------



## j1n M@tt (Jan 25, 2008)

Use Broland 32-bit C++ Compiler......its free,light on resource,easy to understand and best suited for C/C++ project works......all of our group's works(Centium inc.) r done on this IDE.


----------



## nileshgr (Jan 26, 2008)

@the question asker,
if you can't spare clear screen which is included in conio.h then

include stdlib.h && instead of clrscr(); use system("clear");


----------

