-
Code Compile
Hi peeps.
I just wrote a program because im bored.
Here is the code:
Code:
#include <iostream>
using namespace std;
int main()
{
int DOB;
cout << "Please enter your date of birth...\n" << endl;
cin >> DOB
cin.ignore();
if (DOB < 2006) {
cout << "Erh, you were not born in this year!\n" << endl;
}
else if (DOB == 2006) {
cout << "Oioi, howz your first year?\n" << endl;
}
else {
cout << "WTF are you on aboot? You arn't even born yet!\n" << endl;
}
cin.get();
}
But im just wondering how to compile it, can anyone help me?
I'm using Visual C++ 2005 express edition.
-
I am posting this because you did not use code tags on this thread. In the furture please use Code Tags. They make your code MUCH easier to read and people will be much more likely to help you if you do. And they'll be happier about helping you ;)
For example:
Without code tags:
for(int i=0;i<5;i++)
{
cout << "No code tags are bad";
}
With Code Tags:
Code:
for(int i=0;i<5;i++)
{
cout << "This code is easy to read";
}
This is of course a basic example...more complicated code is even easier to read with code tags than without.
I've added code tags for you this time. They can be added by putting [code] at the beginning of your code and [/code] at the end. More information on code tags may be found on the code tag post at the top of every forum. I also suggest you take a look at the board guildlines if you have not done so already.
This is a common first post mistake, just remember to use [code] tags in the future and you'll get much more help.
If this is your first time posting here the welcome, and if there's anything I can do or any questions I can answer about these forums, or anything else, please feel free and welcome to PM me.
Good Luck with your program,
Kermi3
Lead Moderator
edit: Errr it appaers you just mistuped them. In the bottom the '/' goes before "code". Sorry about that.
-
>But im just wondering how to compile it, can anyone help me?
did you create a new project or a new file. iirc you cant compile a file by itself, you have to create a project before you can compile anything.
if you are just starting out id suggest checking out dev c++, its a little easier to get started with.
http://bloodshed.net
-
Open VC++ 2005. Create a new project. Select Win32 Console Application and give the project a name. In the wizard that appears, check the Empty Project box on the Application Settings page.
When the project is created, right-click on the project and add a new file. Select cpp file. Paste your code into the cpp file and save it. Then build your solution (F7) and execute it (Ctrl-F5) or run it through the debuger (F5).
-
hi, and ty, i've just used dev c++ and tried to compile it, but i had a few problems, can anyone help me, i have no idea how to fix the errors
-
that depends, are you going to post what the errors say?
-
DOB.cpp:9: ambiguous overload
for `std::istream& >> std::istream&' operator
DOB.cpp:9: parse error before `
.' token
-
cout << "Please enter your date of birth...\n" << endl;
cin >> DOB
cin.ignore();
Missing semicolon.
-
-
oh, yes there is, i'm really sorry!