| supermariogalaxy said: Yeah, I heard Java wasn't so fun, I heard it's also slower than C++.....But my cousin told me for games, Java has better graphics, is this true??? Oh and here is my Averages program for anyone who wants to use it...(LOL no one does) *NOTE THIS IS NOT MINE, I COULDN'T FIND MINE SO I FOUND AN EXACT COPY ON YOUTUBE AND POSTED IT ON HERE* #include <iostream> int main(int argc, char* argv) { double dnumber1 = 0.0; double dnumber2 = 0.0; double dnumber3 = 0.0; double daverage = 0.0; std::cout << " Luther enter 3 digits or i'll hit you : " << std::endl; std::cin >> dnumber1; std::cin >> dnumber2; std::cin >> dnumber3; daverage = (dnumber1 + dnumber2 + dnumber3) / 3; std::cout << " umm...i think ur average is: " << daverage << std::endl << std::endl; std::cin.get(); return 0; } |
Fix'd with good programming techniques.
First off, see http://www.gidnetwork.com/b-61.html for why you should avoid using system() whenever possible. Basically, it comes down to you needing to halt execution of your program in order to send a message to the OS, yadda yadda yadda. If it *can* be done in C/C++ natively, you should do it that way. If you want to use System calls, just write a shell script to do it 
Not to mention "pause" isn't portable. That code will not work in Linux, for example.
Second, you should avoid using "using namespace std;"
In my experience, shortcuts like that lead to only bad things... like not understanding what a namespace is and why we have them. Not to mention, this way it is much more explicit which "cout" function you are using.
Please, PLEASE do NOT feed the trolls.
fksumot tag: "Sheik had to become a man to be useful. Or less useful. Might depend if you're bi."
--Predictions--
1) WiiFit will outsell the pokemans.
Current Status: 2009.01.10 70k till PKMN Yellow (Passed: Emerald, Crystal, FR/LG)







