| View previous topic :: View next topic |
| Author |
Message |
Turochek Newbie cheater
Reputation: 0
Joined: 20 May 2007 Posts: 13
|
Posted: Fri May 25, 2007 6:39 pm Post subject: New to Programming (First Day) Look at My Progress! |
|
|
Here's my first ever program run in C++. I'm not sure how to present it as an .exe file, so I'll just put the code.
// This progam calculates the user's pay.
#include <iostream>
using namespace std;
int main()
{
float hours, rate, pay;
cout << "How many hours did you work? ";
cin >> hours;
cout << "How much do you get paid per hour? ";
cin >> rate;
pay = hours * rate;
cout.precision(2);
cout.setf(ios::fixed | ios::showpoint);
cout << "You have earned $" << pay << endl;
return 0;
}
She's my baby, and I'm such a proud father.
|
|
| Back to top |
|
 |
benlue Moderator
Reputation: 0
Joined: 09 Oct 2006 Posts: 2142
|
Posted: Fri May 25, 2007 6:44 pm Post subject: |
|
|
Pretty good progress . As motivation , just compile and run and you'll get the hang of how the programs work .
*Good luck* and best wishes !
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun May 27, 2007 12:26 am Post subject: |
|
|
You should fix that, I got like 10 errors when I tried to compile, and yes I was using C/C++ compiler not delphi...
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Sun May 27, 2007 4:20 am Post subject: |
|
|
| oib111 wrote: | | You should fix that, I got like 10 errors when I tried to compile, and yes I was using C/C++ compiler not delphi... |
Then your compiler sucks dick! This is fine!
|
|
| Back to top |
|
 |
hakkairu Legendary
Reputation: 0
Joined: 02 Dec 2006 Posts: 1301
|
Posted: Sun May 27, 2007 7:19 am Post subject: |
|
|
This was mine XD
| Code: | #include <iostream>
int main()
{
std::cout << "Hello, world!\n";
} |
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun May 27, 2007 9:12 am Post subject: |
|
|
| noz3001 wrote: | | oib111 wrote: | | You should fix that, I got like 10 errors when I tried to compile, and yes I was using C/C++ compiler not delphi... |
Then your compiler sucks dick! This is fine! |
My compiler is Dev-C++. It was recommended to me from the site I am taking C++ tutorials. And have you tried compiling it? I mean it looks fine but I can't compile it.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Sun May 27, 2007 9:14 am Post subject: |
|
|
Don't use DEV C++.
_________________
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun May 27, 2007 9:39 am Post subject: |
|
|
Would you suggest a different a compiler? Btw, here is my work for my 1st day:
| Code: |
#include <iostream>
using namespace std;
int dev ( int x, int y );
int main()
{
int x;
int y;
cout<<"Please input two numbers to be devided:\n";
cin>> x >> y;
cin.ignore();
cout<<"The quotient of your two numbers is "<< dev ( x, y ) <<"\n";
cin.get();
}
int dev ( int x, int y )
{
return x / y;
}
|
It devides 2 numbers for you. It's kind of useless because there is a calculator on everyones com but still...
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
UnLmtD Grandmaster Cheater
Reputation: 0
Joined: 13 Mar 2007 Posts: 894 Location: Canada
|
Posted: Sun May 27, 2007 9:46 am Post subject: |
|
|
Appalsap recommended code::blocks for some other dude. I personally use VC++
_________________
|
|
| Back to top |
|
 |
DeltaFlyer Grandmaster Cheater
Reputation: 0
Joined: 22 Jul 2006 Posts: 666
|
Posted: Sun May 27, 2007 10:24 am Post subject: |
|
|
| zomgiownyou wrote: | | Appalsap recommended code::blocks for some other dude. I personally use VC++ |
code::blocks is an IDE; what this guy needs is a compiler.
_________________
Wow.... still working at 827... what's INCA thinking?
zomg l33t hax at this place (IE only). Over 150 people have used it, what are YOU waiting for? |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Sun May 27, 2007 11:43 am Post subject: |
|
|
| DeltaFlyer wrote: | | zomgiownyou wrote: | | Appalsap recommended code::blocks for some other dude. I personally use VC++ |
code::blocks is an IDE; what this guy needs is a compiler. |
Well no duh. Man screw this I will just get Borland 2005 C++
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
SF I'm a spammer
Reputation: 119
Joined: 19 Mar 2007 Posts: 6028
|
Posted: Sun May 27, 2007 2:06 pm Post subject: Re: New to Programming (First Day) Look at My Progress! |
|
|
| Turochek wrote: | Here's my first ever program run in C++. I'm not sure how to present it as an .exe file, so I'll just put the code.
// This progam calculates the user's pay.
#include <iostream>
using namespace std;
int main()
{
float hours, rate, pay;
cout << "How many hours did you work? ";
cin >> hours;
cout << "How much do you get paid per hour? ";
cin >> rate;
pay = hours * rate;
cout.precision(2);
cout.setf(ios::fixed | ios::showpoint);
cout << "You have earned $" << pay << endl;
return 0;
}
She's my baby, and I'm such a proud father.  |
To turn it into a .exe you have to make a Release version.
I know how..but dunno how. There's stuff I had to copy before to make a release in school, teacher showed me then I forgot.
|
|
| Back to top |
|
 |
TheSorc3r3r I post too much
Reputation: 0
Joined: 06 Sep 2006 Posts: 2404
|
Posted: Sun May 27, 2007 3:59 pm Post subject: Re: New to Programming (First Day) Look at My Progress! |
|
|
| SaviourFamily wrote: | | To turn it into a .exe you have to make a Release version. |
Debug mode compiles to native code too.
@oib111, did you compile as console app & not win32? I can't think of any other reason why that would fail.. what were your errors?
_________________
Don't laugh, I'm still learning photoshop! |
|
| Back to top |
|
 |
Meso Master Cheater
Reputation: 0
Joined: 16 May 2007 Posts: 292 Location: Behind my moniter
|
Posted: Sun May 27, 2007 4:51 pm Post subject: Re: New to Programming (First Day) Look at My Progress! |
|
|
| Turochek wrote: | Here's my first ever program run in C++. I'm not sure how to present it as an .exe file, so I'll just put the code.
// This progam calculates the user's pay.
#include <iostream>
using namespace std;
int main()
{
float hours, rate, pay;
cout << "How many hours did you work? ";
cin >> hours;
cout << "How much do you get paid per hour? ";
cin >> rate;
pay = hours * rate;
cout.precision(2);
cout.setf(ios::fixed | ios::showpoint);
cout << "You have earned $" << pay << endl;
return 0;
}
She's my baby, and I'm such a proud father.  |
ROFL THATS FROM A C++ BOOK I READ ONCE HAHA U PHAIL
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Sun May 27, 2007 4:54 pm Post subject: |
|
|
| DeltaFlyer wrote: | | Code::blocks is an IDE; what this guy needs is a compiler. |
Code::blocks is a good free IDE, and many companies (microsoft, borland) will sell their IDEs but give away their command line compile tools for free. If you set up Code::blocks to use those you can have a nice functional IDE with the functionality and flexibility of the more expensive tools.
|
|
| Back to top |
|
 |
|