iistapp wrote:LoGiCaL__ wrote:
You obviously have to write the code after learning the concept otherwise it won't stick. I like to take it in parts. If there is something I don't understand I keep at it until it makes sense and I can implement it on my own. As for your question about Dev-C++, I can't give you an answer to that as I have never used Dev-C++ . I just write my code in the nano text editor and compile with gcc .
I have no idea about what you just said in the last part there.. But compileing a program means "making it understandable" so you can run it right?
Do you run linux?
To compile the code just means to make the code so the computer can understand it. So in that respect you are right. See here for more info:
http://en.wikipedia.org/wiki/CompilerAlso, I do run linux. I Just like writing in linux better than windows. The syntax varies between the two here and there. When I write in windows I usually prefer to use notepad++, which has syntax highlighting for many different languages.
-- 29 May 2012, 15:34 --
No idea what just happened to the last thing I (?) Wrote there, I'm going to try do some writing tomorrow, I'll keep this thread alive once I start getting some results and make some notes as I go along if anyone would be interested.
Would also love if someone could give me some feedback on the code I write to tell me what I can do better or what I simply did wrong.
Cheerio for now!

-- 30 May 2012, 11:53 --
Whooopdidoo! Here we go.
- Code: Select all
// This too was standard in my program, I know iostream got something to do with some commands in c++?
#include <cstdlib>
#include <iostream>
using namespace std;
// This shit I have no idea what means either, it was just here as standard in my program too.
int main(int argc, char *argv[])
{
cout << "You so silly";
cout << endl;
system("pause");
system("cls");
cout << "Now you have to play my game";
cout << endl;
system("pause");
system("cls");
int secretNumber = 0;
srand(time(0));
secretNumber = rand() % 10;
bool guessIsRight = false;
do {
int guess;
cout << "Type your number (0-10): ";
cin >> guess;
if (guess < secretNumber)
cout << "Too low"
<< endl;
else if (guess > secretNumber)
cout << "Too high"
<< endl;
else
guessIsRight = true;
} while (!guessIsRight);
cout << "Well done, you guessed right!"
<< endl;
system("pause");
}
Happy if anyone care to tell me how messy it is and how I should go about to do it better.

-- 31 May 2012, 09:44 --
- Code: Select all
// Includes commands like cout to the program? Still no idea what #include <cstdlib> does so I removed that too.
#include <iostream>
using namespace std;
// Still no idea what int argc, char *argv [] actually does, so I simply just removed the whole thing.
int main()
{
cout << "You so silly";
cin.get();
system("cls");
cout << "Now you have to play my game";
cin.get();
system("cls");
int secretNumber = 0;
srand(time(0));
secretNumber = rand() % 100;
bool guessIsRight = false;
do {
int guess;
cout << "Type your guess (0-100): ";
cin >> guess;
if (guess < secretNumber)
cout << "Too low"
<< endl;
else if (guess > secretNumber)
cout << "Too high"
<< endl;
else
guessIsRight = true;
} while (!guessIsRight);
system("cls");
cout << "Well done, you guessed right!\n";
system("pause");
}
Just did some improvements? To it, as always, would love some feedback!
