Sunday, July 12, 2009

More C++ Help Needed?

Please fix this program:











//


// Triangle Area Calculator Startup template


#include %26lt;cstdio%26gt;


#include %26lt;cstdlib%26gt;


#include %26lt;iostream%26gt;


using namespace std;





int main( int nNumberofArgs , char* pszArgs[])


{








//Height variable assignment





int height;


coup %26lt;%26lt; "What is the height of the triangle";


cin %26gt;%26gt; height;








//Base variable assignment





int base;


coup %26lt;%26lt; "What is the base length of the triangle";


cin %26gt;%26gt; base;








//Calculation Era


int area;


area = (1/2 * height)*base;








//Display of Answer


cout %26lt;%26lt; "The area of this triangle is:";


cout %26lt;%26lt; area %26lt;%26lt; endl;


system("PAUSE");


return 0;


}








Here are the error messages my complier gave me:





Message Line


In (The URL of my .CPP file)


15 '


15 (Each

More C++ Help Needed?
No! Learn to fix your programs. You're learning C++ right? How can you call this learning C++? You're typing bad code, then dumping it on us to fix it for you. Do your own #!@# homework.





If you can't read the error outputs, then *learn it*. They aren't alien gobbledegook. Yes, STL messages can be awkward, but otherwise, it's learnable. If you don't understand an error message, and Google isn't helping:





WRONG QUESTION: What's wrong?


RIGHT QUESTION: How do I learn to fix what is wrong? I don't understand the error messages, I googled, but I still don't understand. How can I understand the compiler and linker errors?
Reply:Did you mean to say:





coup %26lt;%26lt; "What is the height of the triangle";





coup, to the best of my knowledge, is not a member of iostreams.








Perhaps it's a typo?


No comments:

Post a Comment