![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbah
Join Date: Nov 2007
Location: RI
Posts: 3
Rep Power: 0
![]() |
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 c++ Syntax (Toggle Plain Text)
|
|
|
|
|
|
#2 | ||
|
Programmer
Join Date: Oct 2007
Posts: 39
Rep Power: 0
![]() |
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. |
||
|
|
|
|
|
#3 | |
|
hi: for(;;) goto hi;
|
Re: Simple C++ Help
Quote:
/t should be \t.
__________________
How do you play Religious Roulette? Stand around in a circle and blaspheme till someone gets struck by lightning. |
|
|
|
|
|
|
#4 |
|
Newbah
Join Date: Nov 2007
Location: RI
Posts: 3
Rep Power: 0
![]() |
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. c++ Syntax (Toggle Plain Text)
|
|
|
|
|
|
#5 |
|
hi: for(;;) goto hi;
|
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. c++ Syntax (Toggle Plain Text)
__________________
How do you play Religious Roulette? Stand around in a circle and blaspheme till someone gets struck by lightning. |
|
|
|
|
|
#6 |
|
Newbah
Join Date: Nov 2007
Location: RI
Posts: 3
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#7 |
|
hi: for(;;) goto hi;
|
Re: Simple C++ Help
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.
__________________
How do you play Religious Roulette? Stand around in a circle and blaspheme till someone gets struck by lightning. |
|
|
|
|
|
#8 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 770
Rep Power: 3
![]() |
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.
__________________
<insert disclaimer here> <insert shameless plug for Visual Studio here> |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Simple Tic Tac Toe Game | smita | Existing Project Development | 0 | Mar 15th, 2007 8:57 AM |
| PLS Help me in a very simple (noob) program about textfields and textareas. | javaN00b | Java | 3 | Mar 29th, 2006 10:45 PM |
| Simple input | Oddball | Java | 6 | Mar 12th, 2006 7:30 PM |
| a simple linking loader for SIC/XE | programmingnoob | C++ | 3 | Feb 27th, 2006 12:35 AM |
| Simple Function Questions | meverha1 | C++ | 16 | Sep 12th, 2005 2:25 AM |