Hello. Can someone give me examples of 'some code' that I can practice with 'in' the code blocks ide? I'd like to get a feel for things further of the program.
Is it true that if I start I 'new project' that in a small way there is already a template..that you are forced into using. First you 'title' your new project..go thru the 'wizards'..then you'll eventually be brought to the 'Editor's' screen..where you would then go about using your knowledge of the C++ programming that you need to have learned already to create something.
What do you mean examples of some code?
Here is some code for a program I made that you can copy and paste into codeblocks and run, it calculates the miles per gallon of a car.
#include <iostream>
using namespace std;
int main()
{
int Gallons;
int Miles;
int MilesPerGallon;
cout << "How many gallons does your car hold? " <<endl;
cin >> Gallons;
cout << "To clarify, your car holds " << Gallons << " gallons of gas." <<endl;
cout << "How many miles can your car travel on a full tank of gas?" <<endl;
cin >> Miles;
cout << "So your car can travel " << Miles << " miles with " << Gallons << " gallons of gasoline?" <<endl;
MilesPerGallon = Miles / Gallons;
cout << "You can travel " << MilesPerGallon << " miles per gallon with your car." <<endl;
return 0;
}
I've never really made new projects, but if you are new to codeblocks I recommend making a newFile and clicking on C/C++ Source. You will be writing your code in that file.
I've never really made new projects, but if you are new to codeblocks I recommend making a newFile and clicking on C/C++ Source. You will be writing your code in that file.
I recommend one does make a project. It's not hard, and will work a lot better when one does have more than one file. One might as well not use an IDE if they are going to just edit a single file.
1 2 3 4 5
int Gallons;
int Miles;
int MilesPerGallon;
// ......
MilesPerGallon = Miles / Gallons; // integer division - be careful with that !!
Better to use double type. Always check for division by zero.
If you have a console application, the program will open a console. It's a bit like a command prompt window (aka shell) but your program is the command being run, and it allows you to input information, and obviously output info from your program.
One can achieve the same thing by running your program from the command line, instead of from the IDE.
Good Luck !!
Edit: Don't worry about asking questions, that is what we are here for :+) There is a difference between a silly question and question about a basic thing, we all had to start from somewhere. A definition of silly/stupid is doing the same thing over and over, knowing that it is wrong.
Hello. The code blocks 'program' has a 'code blocks' forum section people can go to.
It keeps telling me it needs to confirm my email by sending me an activation code.
I never get it.
In the past I was simply able to log on. Now I can't. Also, I was supposed to wait for adminstrator approval..but it is taking forever..and has never came. Do you know what's the problem..and or what should I do?
Thanks for your responses..since it's getting late where I am the questions will be ending soon
@TheIdeasMan
I wasn't using code tags so he could simply copy and paste the program and see what it does on his compiler. I copy and paste other code on here so I can mess around with it on my own and figure out what they're doing. Yes I should've used double, but hey it was one of my first programs so I mean... haha. Good enough right?
@spacecadet11
This site works great! Maybe there is a tiny little thing you might be doing wrong which messes everything up. Double check your email! Make sure everything is typed correctly.
I wasn't using code tags so he could simply copy and paste
I can copy and paste tagged code just as easily as non-tagged code. The advantage of tagged code is being to view it for possible errors without having to copy and paste.
@FurryGuy
Well when I copy and paste code into my compiler (Codeblocks) it seems to copy the line numbers as well. Depending on your compiler that'll happen