![]() |
Simple C++ Help
I just recently purchased a book by the title of "C++ Primer", to help me pick up the language. After going through forty-five pages of text, I came across an exercise that states "Write a program that prompts the user to input two numbers, the base and exponent. Print the result of raising the base to the power of the exponent". I attempted to try and solve this problem, but I believe my script may contain errors. I also believe that I went about the code the wrong way (writing unnecessary script and such). Unfortunately, the book does not provide an answer key and I can't install a compiler on this computer.
The book proves difficult to understand, and it would mean a great deal to me if you guys could help me out. Thanks, Josh :
|
Re: Simple C++ Help
Quote:
Quote:
And unfortunately, if you can't install a compiler, it's going to be very difficult to learn to program. Programming is not a spectator sport. You can get Borland 5.5 and put it on USB Drive and carry the compiler with you. If you'd like to try that, let me know. I'll explain my setup after you have it installed on a Drive. |
Re: Simple C++ Help
Quote:
/t should be \t. |
Re: Simple C++ Help
Hey, thanks for all the help. I recently updated my program following your guy's advice. I also downloaded a compiler and it seems to build fine.
Thanks Again. :
|
Re: Simple C++ Help
You should look into getting an IDE, or at least an advanced text editor. Indentation means nothing to the compiler but a lot to you. Also, when your programs start to get bigger, I'd recommend the
using keyword, so you don't have to qualify each std member.:
|
Re: Simple C++ Help
I'm currently using the Visual Studios 2008 compiler, does it come equipped with an IDE? If not, how do I acquire an IDE? And thanks for recommending the
using keyword. It seems to build my program much faster. |
Re: Simple C++ Help
http://ecuador.latindevelopers.net/p...2/640x476.aspx
This is something like what your IDE should be. Check your start menu, or if you really can't find it see if double clicking a CPP file will open it. |
Re: Simple C++ Help
Visual Studio 2008 is an IDE, and it contains various compilers for the different languages supported (e.g. the CLR). A compiler is just the program that takes your text file and outputs an executable. And IDE is a nice spiffy text editor that automatically invokes the compiler to compile your code when you want to. Some people prefer to use a text editor and invoke the compiler separately from the editing experience. It's a choice, and each side has some benefits.
|
| All times are GMT -5. The time now is 3:16 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC