You are not logged in.
- Topics: Active | Unanswered
Pages: 1
#1 Sep 30, 2008 12:15 PM
- A Guy
- Member

- From: New York City
- Registered: Mar 03, 2008
- Posts: 5,711
- Gems: 0
- Website
Oh, yeah, I own so hard!
I've made something very basic in C++.
// This is the first program I'm building without a base in C++.
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string name;
cout << "Hello, there. What is your name? ";
getline (cin, name);
cout << "Hello " << name << ".\n";
string game;
cout << "What is your favorite game?";
getline (cin, game);
cout << game << " is my favorite game as well!";
string song;
cout << "What is your favorite song? ";
getline (cin, song);
cout << song << " is a good song. Please enter something to exit this program. ";
string leave;
getline (cin, leave);
return 0;
}"Have you seen The Passion yet? Here's a spoiler for you - Jesus dies."

Offline
#2 Sep 30, 2008 12:17 PM
- Paranoia
- Moderator


- From: Minnesota
- Registered: Jun 03, 2006
- Posts: 4,346
- Gems: 136
- Birthday: 6 February
- Gender: Male
- Website
Re: Oh, yeah, I own so hard!
Nice. I would have known what that meant last year, because I took Computer Science, but I forgot everything.
Offline
#3 Sep 30, 2008 12:36 PM
- Stormy
- Administrator


- From: Illinois
- Registered: Jun 01, 2006
- Posts: 10,385
- Gems: 542
- Birthday: 3 April
- Gender: Female
- Website
Re: Oh, yeah, I own so hard!
[sub]Cool, nice job. I'm surprised I still remember that from Computer Science last year. I guess it was more important to me than it was to you, DDR. (What am I supposed to call you on the internet? ._.)
Anyways, what does that line "using namespace std" do? SR kept putting that into my programs, but we never used it in class. [/sub]
Offline
#4 Sep 30, 2008 12:54 PM
- A Guy
- Member

- From: New York City
- Registered: Mar 03, 2008
- Posts: 5,711
- Gems: 0
- Website
Re: Oh, yeah, I own so hard!
I dunno, and it works without it, but I just add it anyways.
"Have you seen The Passion yet? Here's a spoiler for you - Jesus dies."

Offline
#5 Sep 30, 2008 2:35 PM
- Phoenix_Flyer
- Member

- From: North Yorkshire, UK
- Registered: Feb 27, 2008
- Posts: 4,845
- Gems: 0
- Age: 34 years old
- Website
Re: Oh, yeah, I own so hard!
Yeah, I have no clue about that. I know how to work computers, but I have no idea of the mechanics behind them....
"The phoenix hope, can wing her way through desert skies. And still defying fortune's spite; revive from ashes and rise."
Offline
#6 Sep 30, 2008 7:41 PM
- Reivan
- Member

- From: Somewhere, out there, Beneath
- Registered: Jan 04, 2008
- Posts: 560
- Gems: 0
- Website
Re: Oh, yeah, I own so hard!
thats a basic code, like the ones found on Microsoft Visual Basic. I did some work on that programme last year.
"Hope shines through me, I am the bearer. Through me, you also can feel what I feel" Reivan
www.midgetgamer.proboards.com
Offline
#7 Oct 01, 2008 12:13 AM
- Paranoia
- Moderator


- From: Minnesota
- Registered: Jun 03, 2006
- Posts: 4,346
- Gems: 136
- Birthday: 6 February
- Gender: Male
- Website
Re: Oh, yeah, I own so hard!
[sub]Cool, nice job. I'm surprised I still remember that from Computer Science last year. I guess it was more important to me than it was to you, DDR. (What am I supposed to call you on the internet? ._.)
Anyways, what does that line "using namespace std" do? SR kept putting that into my programs, but we never used it in class. [/sub]
Yeah, I kind of just wanted to try the class to see if I was interested. I wasn't, but oh well.
You can call me Evan, I don't care.
Offline
#8 Oct 01, 2008 2:24 AM
- Spyrorocks
- Administrator


- From: Australia Mate!
- Registered: May 21, 2006
- Posts: 4,122
- Gems: 14
- Website
Re: Oh, yeah, I own so hard!
Heres some C++ code to think about...
long gcd(long a, long b) {
return b == 0 ? a : gcd(b, a%b);
}Finds the Greatest common factor of 2 numbers.

Offline
#9 Oct 01, 2008 2:42 PM
- A Guy
- Member

- From: New York City
- Registered: Mar 03, 2008
- Posts: 5,711
- Gems: 0
- Website
Re: Oh, yeah, I own so hard!
Thanks to some instruction, I've made a calculator!
#include <iostream>
using namespace std;
int main()
{
float number1;
float number2;
float number3;
float numbertot;
int again;
again = 1;
cout << "This is a calculator that I made.";
cout << "This program will multiply three numbers. Please put in actual numbers or you will be spammed to hell.";
while (again == 1)
{
cout << "\nPlease type in first number you wish to multiply.";
cin >> number1;
cout << "\nPlease type in second number you wish to multiply.. ";
cin >> number2;
cout << "\nPlease type in the third number you wish to multiply. ";
cin >> number3;
numbertot=(number1)*(number2)*(number3);
cout << "\nThe product of the three numbers is " << (numbertot) << ".";
cout << "\nWould you like to perform another calculation? Type 1 for yes or 2 for no. ";
cin >> again;
}
cout << "See ya.";
return 0;
}"Have you seen The Passion yet? Here's a spoiler for you - Jesus dies."

Offline
Pages: 1