Sponsor Advertisements help keep UGN Security Online.
Sponsor Advertisements help keep UGN Security Online.
Want to earn prizes for clicking online advertisements? Join Rewards1.com.
|
|
|
#17347 - 02/15/03 07:42 AM
First Program (What u think)
|
UGN News Staff
Registered: 11/29/02
Posts: 1146
Loc: 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
|
|
|
|
Sponsor Advertisements help keep UGN Security Online.
Sponsor Advertisements help keep UGN Security Online.
|
|
#17349 - 02/15/03 07:40 PM
Re: First Program (What u think)
|
UGN News Staff
Registered: 11/29/02
Posts: 1146
Loc: 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)
|
UGN News Staff
Registered: 11/29/02
Posts: 1146
Loc: Canada
|
#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)
|
Junior Member
Registered: 03/06/02
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)
|
Junior Member
Registered: 03/06/02
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
|
|
|
|
#17355 - 02/18/03 04:16 PM
Re: First Program (What u think)
|
UGN News Staff
Registered: 11/29/02
Posts: 1146
Loc: 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
|
|
|
|
#17357 - 03/07/03 04:14 PM
Re: First Program (What u think)
|
UGN Elder
Registered: 03/01/83
Posts: 55
Loc: 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 01:52 AM
Re: First Program (What u think)
|
UGN News Staff
Registered: 11/29/02
Posts: 1146
Loc: 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 09:42 AM
Re: First Program (What u think)
|
Junior Member
Registered: 08/08/03
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 09:15 PM
Re: First Program (What u think)
|
Junior Member
Registered: 09/01/03
Posts: 36
Loc: 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/02/03 12:19 AM
Re: First Program (What u think)
|
UGN's Resident Homo
Registered: 03/16/02
Posts: 599
Loc: 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
|
|
|
|
|
Registered: Today at
Posts: 1
|
|
2200 Members
46 Forums
24936 Topics
60106 Posts
Max Online: 1567 @ 04/25/10 10:20 AM
|
|
|
2 registered (heathdyer, Thes33ker),
275
Guests and
220
Spiders online. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|