![]() |
|
#1
|
|||
|
|||
Math program (small) compiling and math errors .Hey guys im trying to learn C++.
This was a simple program i made while reading C++ For dummies CPP / C++ / C Code:
First it said, KibblesCount is undeclared. So i put Code:
Then, when i put an integer to basically "Feed the dog" it spammed it then exited. What this prog does -------------------- You experts know but for the lazy, im trying to make it so when you enter an integer, it will say Num Num Num that many times. Thanks in advance Last edited by LuciWiz : 30-Apr-2009 at 02:10.
Reason: Please insert your C++ code between [cpp] & [/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: Math program (small) compiling and math errors .What is spammed? you mean endless loop?
You have: while(NumCount > 0) What do you think NumCount's value is? You can see by printing it. Just add to the exsiting print: cout << "Num num num num thanks! NumCount=" << NumCount << endl; Try that and see it you understand better what is wrong. also windows.h is not being used in your program , don't include it. The only thing you need cstdlib.h for is the system() function in. system("PAUSE"); PAUSE is window specific. You can pause C++ style instead: cin.get(); // waits until return is pressed then you can loose #include <cstdlib.h> too. (you'll also learn something else about user input , you might need two cin.get(); 's. Why? (more will be revealed): ) So you'll just have: #include <iostream> using namespace std; |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The