Jump to content

Featured Replies

Posted

is there a difference between languages in C++ and VC++???

 

i downloaded MS VC++ 2005 express beta edition from microsoft last night....today wen i started using it, it seemed easy to use but then all the codes are different...

 

i did this program

 

#include <iostream>

#include <conio.h>

 

using namespace std;

 

int main()

{

cout<<"YO.\n";

getch();

}

 

 

and it said errors

  • Replies 87
  • Views 711
  • Created
  • Last Reply

Top Posters In This Topic

Why the hell are you using namespaces in such a simple program?

 

Most people don't understand what namespaces are for, they're not an unnecessary layer of abstraction (think java) to make you look leet.

 

Maybe posting the errors will get you help instead of sarcasm.

  • Author

i dunno wat compiler u are using...but in my DEV C++ compiler....if u dont have namespace, then it wont recognize wat the fuck "COUT<<" is...

 

n im not asking for ur help u asscrack...i just wanna know is there a difference cuz i run the program in DEV C++...nothing's wrong...in MS VC++...theres an error but it wont tell me wat error

Try #include <iostream.h> when not using namespaces.

 

Maybe you should grab a copy of C++ for Dummies and use the free GCC compiler it comes with. (it's probably better than the crap you're using)

  • Author

as i said...

i follow the tutorials i read on Cprogramming.com go ahead n see it for urself...

the tutorial tells the reader to download a free copy of DEV C++ first....

then get started wit th codes...i read the tutorials atleast 50 times....now wen i wanna use VC++, i copy n paste my codes in...n it said it doesnt work

/* Half Life 2's Source Engine
By Valve. */
#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
cout<<"YO.\n";
getch();
}

Four problems with your code...

1) "#include <iostream>" should be "#include <iostream.h>"

2) "cout<<"YO.\n";" should be "cout << "YO.\n";"...

3) You must've taken that out of one SHITTY C++ book.

4) C++ sucks, use C or ASM, otherwise it doesn't look too "1337".

li $a0, 2 y'all.

  • Author

the program i wrote...works on DEV-C++ wit no problems...

 

but wen i copy n paste it to MS VC++ express 5, it says there are problems...

 

i tried using <iostream.h>....same problem but this time the .exe wont even start up....

First off, namespaces are necessary for newer compilers (VC++ 2002 and greater). The older non-standard headers do not work (i.e. <iostream.h>, must use <iostream>). My guess is you don't have your paths setup correctly. Also try taking out the <conio.h> and the getch(). <conio.h> isn't part of the standard, and you don't need it with Visual C++ anyways (getch just waits for you to press a key before quiting the program).
arent namespaces (i am PRETTY sure they are) so that you dont have to type standard:cout or mabey its std:cout everytime. they are purely for saving time. but whatever, i dont know.

Actually namespaces are so that you don't have name conflicts. For example you wrote a string class, and I wrote a string class. Without namespaces we couldn't use both string classes because they'd conflict, and the compiler will complain. So I could put my class in a unique namespace, and you can put yours in a namespace, and we could use both classes.

 

Now the "using namespace std;" statement saves on typing, but pollutes the global namespace, which is bad and goes against the purpose of namespaces. For learning, the statement allows you to open everything up without having to know what namespaces exactly do. In a real project you should use the statements using "std::cout;", etc. for what you specifically use.

  • Author

o well uninstalled ms vc++....couldnt even make a simple program...

 

#include <iostream.h>

 

int main()

{

cout<< "Hello world!\n";

return 0;

}

 

tat wont even work, not even wit using namespace std; and <iostream>

  Pseudo ANIMALISTIC said:
/* Half Life 2's Source Engine
By Valve. */
#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
cout<<"YO.\n";
getch();
}

Four problems with your code...

1) "#include <iostream>" should be "#include <iostream.h>"

2) "cout<<"YO.\n";" should be "cout << "YO.\n";"...

3) You must've taken that out of one SHITTY C++ book.

4) C++ sucks, use C or ASM, otherwise it doesn't look too "1337".

li $a0, 2 y'all.

 

 

1. REAL compilers don't recognize iostream.h anymore

2. compilers ignore newspace characters, so theres no difference between cout<<"YO.\n"; and cout << "YO.\n";

3. YOU must have read a shitty C++ book

4. Actually, Java kicks both C++ and C's ass.

 

I hope yiou get raped by a crooked eye 500 pound nigger when youre arrested for being a dumbass

  Quote
4. Actually, Java kicks both C++ and C's ass.

 

I have to disgree on that. Not to say Java is worser than C++ or C, anymore than the other way around. No language is better than another, but rather one language may be better suited for a particular problem.

  RogueP2 said:
I have to disgree on that. Not to say Java is worser than C++ or C, anymore than the other way around. No language is better than another, but rather one language may be better suited for a particular problem.

 

I respect your opinion.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Just kidding! You're wrong! :fingersx:

Oh, I didn't realize you weren't a programmer, and obviously stupid. I'll leave you to your ignorance.

Actually you are wrong. Fortran, for example, is worse then many other languages in every conceivable way. Or even less controversial, how about languages like brainfuck? Go ahead and write something in that Oh enlightened one...

 

 

BTW, "Worser" isn't a word.

First off, Fortran excels in calculations, and in this regard can be even faster than C in the choosen problem area. Now, I don't understand what this has to do with Java having the absolute advantage over C\C++ as imascatman has stated? If you want to include every language on the programming spectrum, then the better programming language for the job depends on multiple factors (i.e. intent, main purpose, design, etc), as well as your problem domain (the problem in which you wish to solv).

 

As for brainfuck, you have to look at the context in which the designer had planned for the language. The designer's goal was a small (turing-complete) language for Amiga. Just because you have no use for the language, doesn't mean it doesn't excel in some way, or isn't useful for someone.

 

As for your anal comment about spelling, I don't really care. I could personally talk about your grammar, not saying mine is any better, but I'm not the anal retentive one.

 

Now quick pulling languages out of your ass to try and make a mote point.

  • Author
  Pseudo ANIMALISTIC said:
/* Half Life 2's Source Engine
By Valve. */
#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
cout<<"YO.\n";
getch();
}

Four problems with your code...

1) "#include <iostream>" should be "#include <iostream.h>"

2) "cout<<"YO.\n";" should be "cout << "YO.\n";"...

3) You must've taken that out of one SHITTY C++ book.

4) C++ sucks, use C or ASM, otherwise it doesn't look too "1337".

li $a0, 2 y'all.

 

 

  imascatman said:
1. REAL compilers don't recognize iostream.h anymore

2. compilers ignore newspace characters, so theres no difference between cout<<"YO.\n"; and cout << "YO.\n";

3. YOU must have read a shitty C++ book

4. Actually, Java kicks both C++ and C's ass.

 

I hope yiou get raped by a crooked eye 500 pound nigger when youre arrested for being a dumbass

 

 

u said it man!......n by the way to who ever posted the quote within this quote...

 

cout<<" W/E U PUT HERE \n"; is the real syntax...not

cout<<" W/E U PUT HERE "\n"; or w/e it was i forgot

I don't know what the hell I'm talking about, but shouldnt' that function also be returning a value?

 

return 0;

um, java is used for web applets, its used only for the intra/ernet, c and c++ arent. you are a fucking idiot. go learn a real language, then maybe you wont defend java since its the only one you know.

Ok im not going to read through this whole thread, but if its not compiling on msvc++ 2005, id say try it on 2003, because the 2005 beta doesnt have all the API's included.

 

Also java isnt just for internet, its just an interprited language (for the record, 90% of the syntax is the same as c/c++)

 

And to the idiot that said c++ sucks, use c or asm, dont ever try to code anything other than 5 line programs.

Guest
This topic is now closed to further replies.