|
Here my program:
#include <io.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
int main()
{
int bets, bets_made, bet_num[50], betmoney[50];
short roulette_choice, spinval;
double num_bets;
int betcheck = -1;
long cash = 500;
short bet = 0;
while ( !bet )
{
menumain: printf ( "\n\n\n *** Roulette ***\n" );
printf ( "(1): Place a bet\n" );
printf ( "(2): Check your cash\n" );
printf ( "(3): Mortage your house\n" );
printf ( "(4): Quit Roulette\n" );
printf ( "(5): Retire\n" );
printf ( "Please enter your choice: ");
scanf ( "%d", &roulette_choice );
switch (roulette_choice)
{
case 1: printf ( "\n\n\nHow many bets will you place?" );
scanf ( "%d", &num_bets );
num_bets = num_bets - 1;
bets_made = -1;
while (bets_made < num_bets)
{
bets_made++;
beginning:
printf ( "\nWhat number will you place a bet on (0-36)? " );
scanf ( "%d", &bet_num[bets_made] );
if ( 36 < bet_num[bets_made] || 0 > bet_num[bets_made] )
{
goto beginning;
}
printf ( "How much will you bet on number", "%d", &bet_num[bets_made], "?" );
scanf ( "%d", &betmoney[bets_made] );
}
bet= 1;
break;
case 2: printf ( "\n\nYou have $", "%d", &cash, "at this time." );
break;
case 3: printf ( "\n\nI think you need to go cool it for a while." );
return 0;
case 4: printf ( "\n\nReturning to the main menu now." );
return 0;
case 5: return 0;
default: printf ( "\n\nStay away from the bar for a while would ya?" );
goto menumain;
}
}
spinval = rand () %37;
printf ( "\n\n\nThe winning number is ", "%d", &spinval, "!" );
while (betcheck < num_bets )
{
betcheck ++;
if ( bet_num[betcheck] - spinval == 0 )
{
printf ( "\n\n\nYou won with the number ", "%d", &bet_num[betcheck], "!" );
cash = cash + (betmoney[betcheck] * (37.00/num_bets));
bet = betmoney[betcheck] * (37.00/(num_bets + 1));
printf ( "\nYou made $ ");
scanf ( "%d", &bet);
goto main;
}
}
printf ( "\n\nSorry pal, better luck next time\n" );
goto main;
}
Please tell me where is do mistake. Thank you.
|
|
|
|
|
You've got a lot to learn how forums work.
This is the C# forum, not C++.
All you've done is post your code and ask where the problem is. What problem? A description of what your expecting and what your seeing as the problem might help. Yes, I'm too lazy to cut and paste your code into a C++ project to see what it's doing.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i'm doing C Programming for the American Roulette. can u tell me da prob in my program? do u have some sample on roulette? can u send me please? thank you!!
|
|
|
|
|
I hate repeating myself.
YOU have to tell us what the problem is. We're not going to copy and paste your code into a project just to diagnose whatever problem you're not telling us about. What problem are we looking for?
Just posting your code and saying "it won't work" will NOT get you a solution to the problem.
You also have to post in the correct forum. You're posting this question in the C# Forum. You want the Visual C++[^] Forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i hate repeating myself too. and yeah by the way where's the forum then if not here? i'm doing C Programming. and not Visual C++.******
|
|
|
|
|
Look at the top of any forum page. You'll find the link to Visual C++. Since C is just a subset of C++...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave is right, but in addition, did you mean to write a C program, or C++ ? This program is in C not C++. you can still ask in the C++ forum, of course.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I have a application by C# language.I want to encapsulate it become complete application in order to use anywhere.
Please help me.
Thanks!
|
|
|
|
|
Are you saying you need to know that the .NET runtime has to be installed on any machine so your code can run on it ? That's what's needed to ship your app.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Code Start
//Crystal Report Object
CrystalReport2 cp = new CrystalReport2();
CReport cp1 = new CReport();
//Form Load Event
private void Form2_Load(object sender, System.EventArgs e)
{
crystalReportViewer1.ReportSource = cp;
}
//Link Label Click Event
private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
{
try
{
string empid = textBox1.Text.Trim();// H-B39728F employee id
SqlConnection con = new SqlConnection("server=SK-WAQAS;uid=sa;pwd=Butt;database=pubs");
SqlDataAdapter daemp = new SqlDataAdapter("Select * From employee where emp_id= '" + empid + "'", con);
DataSet ds = new DataSet();
daemp.Fill(ds,"employee");
cp.SetDataSource(ds);
con.Close();
}
catch(Exception ce)
{
MessageBox.Show(ce.Message);
}
}
// End Code
When i run this code no record show in Crystal Report. Please tell me where is do mistake. I want to show record in crystal report on the base of emp_id , i use pubs database on Sql server 2000.
Thanks in advance.
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
i'm having this type of error 'Underfined label 'main' in function main' in my program. please can anyone be of help here. thank you! do mail me for more information.
Arshad
|
|
|
|
|
What do you not understand? The compiler message is very clear: 'Underfined label 'main' in function main'
You're using a label called "main" in your function "main" and this label is not defined.
Most likely you've got a syntax error, but without even giving the full and correct error (the compiler didn't output "Underfined" for sure!) or the code line the error occurrs on you won't get any decisive help!
mav
|
|
|
|
|
|
hi dears ,
I have a problem
I create a class with delegate and event !
when i used it in another class with remoting , i recevied this Error :
"Type System.DelegateSerializationHolder and the types derived from it (such as System.DelegateSerializationHolder) are not permitted to be deserialized at this security level."
what is probelm?
|
|
|
|
|
Hello,
I am wondering if anyone can point me in the direction of a nice bit of code to draw a tree structure. Not the tree that is one of the default windows controls, but the list tree structure
O
/ \
O O
/ | \ \
O O O O
like that.
Thanks
The wisest of the wise may err. - Aeschylus
|
|
|
|
|
How does one go about making part of the messagebox() show a web link?
something to the effect of:
MesageBox.Show("Help File Not Found: \n\nTo download the latest Helpfile, go here:" + SomeSortaWeblink(http://www.mysite.com))
Any help is truly Appreciated
-- modified at 0:30 Sunday 2nd October, 2005
|
|
|
|
|
You can't. You'd have to create your own dialog box that has a Link control in it.
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..."
-Jörgen Sigvardsson
|
|
|
|
|
There is no direct solution to this.
What you can do is , write a Customized Message Box (your own Form) which can include this.
Regards
Mahesh
Regards
Mahesh
|
|
|
|
|
i need to serialize an object but before to serialize i want to encrypt it
How can i encrypt? Can someone decrypt it with some program?
|
|
|
|
|
Hi,
don't serilize it directly to a file. First serialize it into a MemoryStream. Then put that one into a CryptoStrem (this article should give you the basic idea on how to use it). The output of that one can then finally be written to a file (FileStream class).
If you use the cryptographic classes correctly it will be very hard to nearly impossible for someone else to decrypt it.
|
|
|
|
|
Hi, tnx for your advise, but just one consideration:
if i use these lines in my code
cryptic.Key = ASCIIEncoding.ASCII.GetBytes(“ABCDEFGH”);
cryptic.IV = ASCIIEncoding.ASCII.GetBytes(“ABCDEFGH”);
it can be get in back by hackers opening my application in assembly code or just if it crash for whatever cause.
Isn't it?
My trouble is can someone got these keys? so use to decrypt manually the stream?
|
|
|
|
|
This is the problem facing everyone, and there is no way around it. There are numerous ways to make it harder for someone to get the keys, but ultimatley if you want to encode and decode from within your program then you will be susceptible to the problems you mentioned.
However, if the user is entering the key/password then it's a different matter entirely, and you can make it very secure.
|
|
|
|
|
I'M TRYING TO BUILD A WEBSITE WITH A DOWNLOAD PAGE.
BUT THE PROBLEM IS; I NEED TO CREATE A CODE FOR THE LINK, ONCE THE CUSTOMER PURCHASES THE PRODUCT AND PAYMENT IS COMFIRMED THEY THEN GO TO THE DOWNLOAD PAGE.
BUT, I DON'T UNDERSTAND HOW TO BUILD THAT CODED DOWNLOAD PAGE LINK, I'M WAY OVER MY HEAD ON THIS ONE.
CAN ANYONE HELP ME BUILD THAT CODED DOWNLOAD LINK? I'M SO CONFUSED.
I DON'T UNDERSTAND THIS CODE WRITTING STUFF,
THIS IS MY FIRST TIME AND I NEED A LOT OF HELP.
PLEASE CAN ANYONE HELP ME? PLEASE.
IT'S SO HARD I DON'T UNDERSTAND...
????
|
|
|
|
|
STOP SHOUTING
dontunderstand wrote:
I DON'T UNDERSTAND THIS CODE WRITTING STUFF,
THIS IS MY FIRST TIME AND I NEED A LOT OF HELP.
I'm sorry so many people voted without giving you advice. My advice, you shouldn't do anything that will be seen in the real world for your first project. You should take the time to learn some stuff first.
A really simple way to do this is with a response.redirect statement in your page when payment is confirmed, which goes to either the zip ( which will start a download ), or the page with the zip ( which you can hide from google, but which someone will hand out, or discover, eventually. You should password protect your zip and send the password as another line of defence and a way to get your clients email addresses ( don't sell them or spam them, but do use them to send info on updates, etc. )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Suppose I have this:
public Pen[] activePen = new Pen[] { new Pen( Color.Blue ), new Pen( Color.Green ), new Pen(Color.Red) };
How to infinitely cycle through the 3 Pens?
thanx
|
|
|
|