LordT Posted February 3, 2003 Report Share Posted February 3, 2003 I've seen discussions about code being a pain in the ... butt... to post on this forums due to text formatting. No more! Using the <pre>-tag text will be typed in a fixed width format and it will keep all whitespaces including tabs (but not here cause tabs switches controls in the posting form...) Example:int main(void){ return 0;} Link to comment Share on other sites More sharing options...
gangsta Posted February 3, 2003 Report Share Posted February 3, 2003 just like main always should return int you should always have the int argc, char *argv[]. because I have seen that cause problems too before.. anyway GCC doesn't allow ya to have main return void at all. Link to comment Share on other sites More sharing options...
LordT Posted February 3, 2003 Author Report Share Posted February 3, 2003 well shoot me... i'm a beginner afterall... and according to my limited knowledge the parenthesis is what the function recieves, not returns. Link to comment Share on other sites More sharing options...
Fatal_Error Posted February 3, 2003 Report Share Posted February 3, 2003 heres tha real code: int main(int argc, char *argv[]) { //do something to kill windows and: if(argc == 0) { printf("Ya biatch!!!\n"); } return 1;} Link to comment Share on other sites More sharing options...
gangsta Posted February 3, 2003 Report Share Posted February 3, 2003 well shoot me... i'm a beginner afterall... and according to my limited knowledge the parenthesis is what the function recieves, not returns. well not knowing those silly rules about how to do main doesn't make you a beginner all the time. It's a lack of standard between compilers I think that's to blame. some C++ compilers void main(void) is good enough. GCC is extra picky about alot of things on purpose to force you into coding nicer. like it doesn't purposly allow you to do certain things with macros because there is no defined ruled. then there other things you learn like #indef blah #ifndef ugh #define blah #define ugh #endif#endif that right there isn't another thing you shouldn't do and I wouldn't have known that if it was for another programmer once pointing it out to me. some precompilers can handle the spaces before the #'s so you shouldn't ident there although I think you can ident after the #. I don't do that either and instead add a comment like // blah after the #endif Link to comment Share on other sites More sharing options...
LordT Posted February 7, 2003 Author Report Share Posted February 7, 2003 well my c++ teacher is pro -void main(void)- so that screw things up once in a while Link to comment Share on other sites More sharing options...
gangsta Posted February 7, 2003 Report Share Posted February 7, 2003 tell your teacher void main(void) won't work with g++.. you have to use at least int void(main). I was very pro void main(void) too until it didn't work on g++ Link to comment Share on other sites More sharing options...
LordT Posted February 7, 2003 Author Report Share Posted February 7, 2003 well the dude speaks at about -50mph and jumps into data-addrasses (&-thing) in functions before he tells one how to do an if-statement.feels like that anywayso i'll stick to online resources and books And know! You should ALWAYS begin every program with including iostream, conio and iomanip! Otherwise you cant use clrscr(); and getch(); DUH !! Link to comment Share on other sites More sharing options...
gangsta Posted February 7, 2003 Report Share Posted February 7, 2003 actually conio.h is borland specific. There is no standard way to clear a console screen in C or C++ anways I'm old skewl and use stdio.h instead of iostreams Link to comment Share on other sites More sharing options...
LordT Posted February 7, 2003 Author Report Share Posted February 7, 2003 WHAT ?! is the borland turbo c++ v1.0 OLD ?! Link to comment Share on other sites More sharing options...
gangsta Posted February 7, 2003 Report Share Posted February 7, 2003 The C/C++ langauge by itself does nothing but logic and loop control and function calling. you have to add the things you want to use by including headers. Link to comment Share on other sites More sharing options...
LordT Posted February 7, 2003 Author Report Share Posted February 7, 2003 i know that! Link to comment Share on other sites More sharing options...
gangsta Posted February 7, 2003 Report Share Posted February 7, 2003 :flame: :crying: guess it is time to get back on topic Link to comment Share on other sites More sharing options...
LordT Posted February 7, 2003 Author Report Share Posted February 7, 2003 what do you want to be able to do/post on this forum then? Link to comment Share on other sites More sharing options...
Recommended Posts