Your browser does not seem to support CSS. If images appear below, please disregard them.
toggle
February
S M T W T F S
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29
Sponsored Links
Latest Postings
Page 1 of 2   1 2 >
Topic Options
Rate This Topic
#17347 - 02/15/03 07:42 AM First Program (What u think)
Joined: Nov 2002
Posts: 1,146
Ice Offline
UGN News Staff
Ice Offline
UGN News Staff

Joined: Nov 2002
Posts: 1,146
Canada
hehe finally decided to learn some C++ so started reading and came up with this prb lol = ) Its some were from a tutorial but i wrote it from scratched, and made it shorter with out a ELSE, Just have Else if's = )

What u guys think hehe

heres the link to the little source = )

http://ice.promodtecnologies.com/cpp.html


Good artists copy, great artists
steal.

-Picasso
Top
Sponsored Links
#17348 - 02/15/03 01:18 PM Re: First Program (What u think)
Joined: Mar 2002
Posts: 1,273
SilentRage Offline
DollarDNS Owner
SilentRage Offline
DollarDNS Owner

Joined: Mar 2002
Posts: 1,273
OH, USA
#include // of course you need the Include guys = )

that's really nice and all, but you're not including anything. It's just a #include without anything after it. I'm surprised whatever compiler you used doesn't scream at you.

And there's a logic bug in your program. It doesn't do anything if you enter 30.


Domain Registration, Hosting, Management
http://www.dollardns.net
Top
#17349 - 02/15/03 07:40 PM Re: First Program (What u think)
Joined: Nov 2002
Posts: 1,146
Ice Offline
UGN News Staff
Ice Offline
UGN News Staff

Joined: Nov 2002
Posts: 1,146
Canada
hehe, THis is was my first 30 min working with C++
of course theres gonna be bugs man


Good artists copy, great artists
steal.

-Picasso
Top
#17350 - 02/18/03 12:22 AM Re: First Program (What u think)
Joined: Nov 2002
Posts: 1,146
Ice Offline
UGN News Staff
Ice Offline
UGN News Staff

Joined: Nov 2002
Posts: 1,146
Canada
Code:
#include <iostream.h>

int main()
{
int num;
cout<<"Please Guess the Number 1,2,3,4,5,6,7: ";
cin>>num;
if(num==1)
{
cout<<"Sorry Try Again";
}
else if(num==2)
{
cout<<"Sorry Try Again";
}
else if(num==3)
{
cout<<"Sorry Try Again";
}
else if(num==4)
{
cout<<"Sorry Try Again";
}
else if(num==5)
{
cout<<"Ding Ding That is The Correct Number";
}
else if(num==6)
{
cout<<"Sorry Try Again";
}
else if(num==7)
{
cout<<"Sorry Try Again";
}

int a;
cin >> a;
return 0;
}
Heres another one lol = )
Little longer but simple stuff
Just geting used the Program itself


Good artists copy, great artists
steal.

-Picasso
Top
#17351 - 02/18/03 01:24 AM Re: First Program (What u think)
Joined: Mar 2002
Posts: 71
CryptoKnight Offline
Junior Member
CryptoKnight Offline
Junior Member

Joined: Mar 2002
Posts: 71
whats the int a at the end for? and thats too many else if statements in my opinion. use a switch case instead. Then again, thats just about style.

tut on switch statements


"If you let your wife stand on your toe tonight, she'll stand on your face tomorrow morning" - Sir/Saint Thomas More

-CryptoKnight-
Top
#17352 - 02/18/03 01:27 AM Re: First Program (What u think)
Joined: Mar 2002
Posts: 71
CryptoKnight Offline
Junior Member
CryptoKnight Offline
Junior Member

Joined: Mar 2002
Posts: 71
oh, i just read your other program. Thats not how you stop it so you can see it, you are just wasting memory (not like its a lot but hey, its better you dont get used to it now that you are startin to learn).
#include "conio.h"
getch(); //that will pause till you press a key


"If you let your wife stand on your toe tonight, she'll stand on your face tomorrow morning" - Sir/Saint Thomas More

-CryptoKnight-
Top
#17353 - 02/18/03 04:55 AM Re: First Program (What u think)
Joined: Mar 2002
Posts: 1,136
pergesu Offline
UGN Elite Poster
pergesu Offline
UGN Elite Poster

Joined: Mar 2002
Posts: 1,136
Pimpin the Colorizzle
You don't need all those else if's, either... just do:
if(num == 5)
{
cout<<"Ding Ding That is The Correct Number";
}
else
{
cout<"Sorry Try Again";
}

Top
#17354 - 02/18/03 05:27 AM Re: First Program (What u think)
Joined: Feb 2002
Posts: 7,194
Gremelin Offline
Community Owner
Gremelin Offline

Community Owner

Joined: Feb 2002
Posts: 7,194
Portland, OR; USA
Yeh try to keep the code clean and simple, a little space goes a long way...


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Top
#17355 - 02/18/03 04:16 PM Re: First Program (What u think)
Joined: Nov 2002
Posts: 1,146
Ice Offline
UGN News Staff
Ice Offline
UGN News Staff

Joined: Nov 2002
Posts: 1,146
Canada
Thanks for the Tips, Just started learning on Sunday. man i made it long and it could fit in 5 lines lol = )


Good artists copy, great artists
steal.

-Picasso
Top
#17356 - 02/20/03 03:00 PM Re: First Program (What u think)
Joined: Mar 2002
Posts: 256
ninjaneo Offline
UGN Security Staff
ninjaneo Offline
UGN Security Staff

Joined: Mar 2002
Posts: 256
CA, USA
heh and CIN and COUT is not included in linux's gcc compiler we have to use g++

Top
#17357 - 03/07/03 04:14 PM Re: First Program (What u think)
Joined: Mar 1983
Posts: 55
Skull Offline
UGN Elder
Skull Offline
UGN Elder

Joined: Mar 1983
Posts: 55
Iowa
Thats because gcc is a c compiler where as g++ is a c++ compiler, i have used both, and they are the same except for that one thing.
At any rate, good luck with your programming, its fun, but not usually easy. I've spent the last 2 evens for like 6 hours a day working on my one program so, just be prepared to spend alot of time on it. Don't get discouraged, and ENJOY POINTERS! their your friend...

{Mr. Rage, I plan on showing up to irc tonight, if you could be there, i'd like to have you help me test my program to test requirements if you would please}

Regards,

Skull


Trust me, if i started killing people, there'd None of you left
Top
#17358 - 08/14/03 12:52 AM Re: First Program (What u think)
Joined: Nov 2002
Posts: 1,146
Ice Offline
UGN News Staff
Ice Offline
UGN News Staff

Joined: Nov 2002
Posts: 1,146
Canada
man looking at this code i posted makes me laught lol

man those programs could have been made in 4-6 lines

I am on Chp.17 Vairiable Scope
i am reading C++ by Example = )


Good artists copy, great artists
steal.

-Picasso
Top
#17359 - 08/23/03 08:42 AM Re: First Program (What u think)
Joined: Aug 2003
Posts: 68
MESELF Offline
Junior Member
MESELF Offline
Junior Member

Joined: Aug 2003
Posts: 68
maybe you should try to have some fun and have it change the number every time. but hey for being new to programming thats not too bad. took me a long time to get even a little c down.

Top
#17360 - 09/01/03 08:15 PM Re: First Program (What u think)
Joined: Sep 2003
Posts: 36
Coleman Offline
Junior Member
Coleman Offline
Junior Member

Joined: Sep 2003
Posts: 36
Castro Valley
So c++ i program that lets u do exactly what?


Applesauce is evil and should be baned from the earth!!!!!!
Top
#17361 - 09/01/03 11:19 PM Re: First Program (What u think)
Joined: Mar 2002
Posts: 599
BackSlash Offline
UGN's Resident Homo
BackSlash Offline
UGN's Resident Homo

Joined: Mar 2002
Posts: 599
TN
don't understand exactly what your asking coleman, try rephrasing it. if you are trying to ask what the above program does, it i just a guessing game. the user enters a number and it tells the user if they got it right or wrong.


"It's better to burn out, than to fade away."
Top
#17362 - 09/02/03 03:45 AM Re: First Program (What u think)
Joined: Sep 2003
Posts: 36
Coleman Offline
Junior Member
Coleman Offline
Junior Member

Joined: Sep 2003
Posts: 36
Castro Valley
Ok let me try and refrase it for you....Ok so what does this program do for for the user that is using it...like if you do get the number right what happens?


Applesauce is evil and should be baned from the earth!!!!!!
Top
#17363 - 09/02/03 09:24 AM Re: First Program (What u think)
Joined: Mar 2002
Posts: 27
-=Toxic Wazte=- Offline
Junior Member
-=Toxic Wazte=- Offline
Junior Member

Joined: Mar 2002
Posts: 27
Va
coleman, the program just tells u if you got it right or wrong, thats all...nothing more. even if u didnt know c++ u could go through the code and at least figure that part out


-=Toxic Wazte=-
Top
#17364 - 09/02/03 11:14 AM Re: First Program (What u think)
Joined: Sep 2003
Posts: 36
Coleman Offline
Junior Member
Coleman Offline
Junior Member

Joined: Sep 2003
Posts: 36
Castro Valley
Wow ok so why would any one want to use this program i mean like is it fun just trying to geuss random numbers in a line?

And thanks for the info Toxic.


Applesauce is evil and should be baned from the earth!!!!!!
Top
#17365 - 09/02/03 09:51 PM Re: First Program (What u think)
Joined: Nov 2002
Posts: 1,146
Ice Offline
UGN News Staff
Ice Offline
UGN News Staff

Joined: Nov 2002
Posts: 1,146
Canada
its just practicing, u think i am going to write a OOP the firt time i try C++ ? Its a usless program but i learned a lot from it.


Good artists copy, great artists
steal.

-Picasso
Top
#17366 - 09/03/03 06:41 AM Re: First Program (What u think)
Joined: Sep 2003
Posts: 36
Coleman Offline
Junior Member
Coleman Offline
Junior Member

Joined: Sep 2003
Posts: 36
Castro Valley
ok i got it thanx for splainin it.


Applesauce is evil and should be baned from the earth!!!!!!
Top
#17367 - 09/03/03 10:40 AM Re: First Program (What u think)
Joined: Sep 2003
Posts: 36
Coleman Offline
Junior Member
Coleman Offline
Junior Member

Joined: Sep 2003
Posts: 36
Castro Valley
I have looked on the web all day and i cant find a free downloadable copy of this c++ program thingy bobber...were did u get yours?
(and did u acctually pay?)


Applesauce is evil and should be baned from the earth!!!!!!
Top
#17368 - 09/03/03 10:01 PM Re: First Program (What u think)
Joined: Nov 2002
Posts: 1,146
Ice Offline
UGN News Staff
Ice Offline
UGN News Staff

Joined: Nov 2002
Posts: 1,146
Canada
Its a Porgraming Language...


Good artists copy, great artists
steal.

-Picasso
Top
#17369 - 09/03/03 10:59 PM Re: First Program (What u think)
Joined: Mar 2002
Posts: 599
BackSlash Offline
UGN's Resident Homo
BackSlash Offline
UGN's Resident Homo

Joined: Mar 2002
Posts: 599
TN
coleman, c++ is a programming language, that means it is used to create other programs. the program ice created has no practical use other than to learn how to program in c++. as for getting c++ go here http://www.borland.com/products/downloads/download_cbuilder.html# click to download the compiler. i believe it is free.


"It's better to burn out, than to fade away."
Top
#17370 - 09/04/03 12:47 AM Re: First Program (What u think)
Joined: Sep 2003
Posts: 36
Coleman Offline
Junior Member
Coleman Offline
Junior Member

Joined: Sep 2003
Posts: 36
Castro Valley
ok thanx backslash i appretiate ur help and patients.


Applesauce is evil and should be baned from the earth!!!!!!
Top
#17371 - 10/01/03 12:58 PM Re: First Program (What u think)
Joined: Oct 2003
Posts: 4
liao505 Offline
Junior Member
liao505 Offline
Junior Member

Joined: Oct 2003
Posts: 4
c
I think that you can use the key-words 'switch' instead of 'if-else'.

Top
Page 1 of 2   1 2 >

Member Spotlight
Gremelin

Gremelin
Portland, OR; USA
Posts: 7,194
Joined: February 2002
Show All Member Profiles 
Forum Statistics
Forums46
Topics43,855
Posts79,029
Members2,157
Most Online1,567
Apr 25th, 2010
Top Posters(All Time)
UGN Security 37,018
Gremelin 7,194
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Newest Members
Herbert_Sherbert, codemauve, Lillysdragon1984, Brewwit, boa
2157 Registered Users
Who's Online Now
0 registered members (), 0 guests and 2 spiders.
Latest News