Author Topic: First c++ program.  (Read 2411 times)

0 Members and 1 Guest are viewing this topic.

DarkMatter

  • Guest
First c++ program.
« on: June 29, 2006, 11:36:14 PM »
Ok here it is, my first c++ program. It's extremely ghetoo (when you enter something other than intergers it will spaz). If someone here knows c++ please feel free to tell me how to improve apon this.  The source file is included in the zip.



Download the attachment :[attachmentid=2262]

Offline yellow please

  • Posts: 2162
    • View Profile
First c++ program.
« Reply #1 on: June 30, 2006, 02:31:35 AM »
Im not downloading it , but is it source or compiled ? and whats it do

Offline Jason

  • 404
  • V.I.P. Member
  • Posts: 7249
  • Grains in the hourglass.
    • View Profile
First c++ program.
« Reply #2 on: June 30, 2006, 04:12:29 AM »
ive heard about C++, but im gonna stick with editing rather than creating thankyou

Offline BlackPearl

  • Posts: 687
    • View Profile
    • http://
First c++ program.
« Reply #3 on: June 30, 2006, 06:07:08 AM »
Lol, downloaded it  pretty funny

Offline Fugitive

  • Veteran Member
  • Posts: 4883
    • View Profile
    • http://www.fugitivesplace.3x.ro
First c++ program.
« Reply #4 on: June 30, 2006, 08:29:52 AM »
I made somethig similar in Borland Pascal. Nice one.

DarkMatter

  • Guest
First c++ program.
« Reply #5 on: June 30, 2006, 08:17:10 PM »
Yea. I made it work correctly today (realized the aligator mouth was pointing in the wrong direction )    >

Offline marklund

  • Posts: 6166
    • View Profile
    • http://
First c++ program.
« Reply #6 on: July 02, 2006, 02:37:18 PM »

DarkMatter

  • Guest
First c++ program.
« Reply #7 on: July 02, 2006, 02:39:05 PM »
Lol yea you got it

Offline Qouad

  • Veteran Member
  • Posts: 1334
    • View Profile
    • http://
First c++ program.
« Reply #8 on: July 06, 2006, 05:18:33 PM »
I don't know nothing about C++...but the program fucks up if you say you are X years old (X=what ever that is not a number)

Looks to me like you did nothing but changed the messages and ages needed, but I guess you've gotta start somwhere
« Last Edit: July 06, 2006, 05:21:48 PM by Qouad »

DarkMatter

  • Guest
First c++ program.
« Reply #9 on: July 06, 2006, 11:30:45 PM »
I did this tutorial step by step to understand some c++ commands and the syntax. I know it is basically copied but like i said. It's my first!

I am going to continue to learn c++ so expect some more programs from me.

Offline Maxwell

  • Veteran Member
  • Posts: 1493
    • View Profile
    • http://www.maxdoiron.com
First c++ program.
« Reply #10 on: July 12, 2006, 08:34:05 PM »
LOL

type a letter in and see what it does

i made a prog like this with basic in the 5th grade

mikechml

  • Guest
First c++ program.
« Reply #11 on: July 13, 2006, 04:19:25 AM »
Code: [Select]
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int iAge;
    char szInput[128];
    printf("Enter your age and press enter: ");
    gets(szInput);
    iAge = atoi(szInput);
    if (iAge < 13) {
        printf("You are a child because you are %d years old", iAge);
    }
    else if (iAge < 20) {
        printf("You are a teenager because you are %d years old", iAge);
    }
    else if (iAge < 66) {
        printf("You are an adult because you are %d years old", iAge);
    }
    else if (iAge < 136) {
        printf("You are an old fart because you are %d years old", iAge);
    }
    else {
        printf("Stop lying, idiot, you are not %d years old!", iAge);
    }
    return 0;
}

 

Offline gunner

  • Senior Member
  • Posts: 2721
    • View Profile
    • ZeroLives.com
First c++ program.
« Reply #12 on: July 13, 2006, 01:43:01 PM »
Quote from: mikechml
Code: [Select]
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int iAge;
    char szInput[128];
    printf("Enter your age and press enter: ");
    gets(szInput);
    iAge = atoi(szInput);
    if (iAge < 13) {
        printf("You are a child because you are %d years old", iAge);
    }
    else if (iAge < 20) {
        printf("You are a teenager because you are %d years old", iAge);
    }
    else if (iAge < 66) {
        printf("You are an adult because you are %d years old", iAge);
    }
    else if (iAge < 136) {
        printf("You are an old fart because you are %d years old", iAge);
    }
    else {
        printf("Stop lying, idiot, you are not %d years old!", iAge);
    }
    return 0;
}

Code: [Select]
//--------------------------------
//Converted to Visual basic 6
//By [NwP] Gunner
//Original code by mikechml
//--------------------------------

Private Sub Form_Load()


Dim age

if age =< "13" then
msgbox "You are a child because you are " & age & " years old."
elseif age =< "20" then
msgbox "You are a teenager because you are " & age & " years old."
elseif age =< "66" then
msgbox "You are an adult because you are " & age & " years old."
elseif age =< "136" then
msgbox "You are an old fart because you are " & age & " years old."
else
msgbox "Stop lying, idiot, you are not " & age & " years old!"
end if


End Sub

PS. dont ask me why i converted it ;|.

DarkMatter

  • Guest
First c++ program.
« Reply #13 on: July 13, 2006, 05:33:14 PM »
Wow basic looks alot more basic compared to c++

Offline Maxwell

  • Veteran Member
  • Posts: 1493
    • View Profile
    • http://www.maxdoiron.com
First c++ program.
« Reply #14 on: July 13, 2006, 07:55:09 PM »
gunners basic code is missing some stuff

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal