עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

בעיה לא מובנת בתוכנית. C

Featured Replies

פורסם

בניתי תוכנית של C שהיא קזינו, עשיתי כזה דבר שכאשר המשתמש מכניס 1 זה יכניס אותו למשחק סלוטים וכאשר לוחץ 2 יכניס אותו לרולטה.

כאשר המשתמש לוחץ 2 הכל עובד הרולטה עובדת כאשר המשתמש לוחץ 1, זה כותב פלט כלשהוא מהתוכנית ואני לא מבין למה הנה החלק הראשון של התוכנית: (תתעלמו מהגוטו בהתחלה): דא התוכנית מביאה אותי תמיד ל: printf("Your Money at the moment is:%d",CASH);

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

#include <time.h>

void main()

{

int slots,bet_slots,choosing_game,CASH=100;

startgame: printf("Welcome to our Casino, please press 1 for slots or 2 for roullete: \n");

scanf("%d", &choosing_game); //Picking which game you want to play slots or roulette.

if(choosing_game==1)

{

// He Picked 1, so it will be a slot game.

char a; //One Char, #, $ ,%.

char b; //Second Char, #, $, %.

char c; //Third Char, #, $, %.

while(CASH>=20)

{

work: printf("You chose slots game, your first bet kit value is 100$ please enter a bet that's above 20$"); // The work here is for GOTO.

scanf("%d", &bet_slots); //The bet money.

if(bet_slots>20) //If the user's bet was higher than 20, because it's a condition for the Casino.

{

srand( (unsigned int) time(NULL));

a = rand() % 3; //Enters a random number from 0 to 2 to the Char A.

b = rand() % 3; //Enters a random number from 0 to 2 to the Char B.

c = rand() % 3; //Enters a random number from 0 to 2 to the Char C.

if (a==b==c==0||a==b==c==1||a==b==c==2) //Checks if the user even won in some way ### or $$$ or %%%.

{

if (a==b==c==0) // ###

{

printf("# # #, YOU WON!!!");

CASH=bet_slots*8-bet_slots;

printf("Slot Machine result: %c%c%c \n", a,b,c);

printf("Your Money at the moment is:%d",CASH); //Shows the money that the user still have.

}

if (a==b==c==1) // $$$

{

printf("$ $ $, YOU WON!!!");

CASH=bet_slots*8-bet_slots;

printf("Slot Machine result: %c%c%c \n", a,b,c);

printf("Your Money at the moment is:%d",CASH); //Shows the money that the user still have.

}

if (a==b==c==2) // %%%

{

printf("% % %, YOU WON!!!");

CASH=bet_slots*8-bet_slots;

printf("Slot Machine result: %c%c%c \n", a,b,c);

printf("Your Money at the moment is:%d",CASH); //Shows the money that the user still have.

}

}

else

{

printf("You lost your game, better luck next time.\n");

CASH=CASH-bet_slots;

printf("Slot Machine result: %c%c%c \n",a,b,c);

printf("Your Money at the moment is:%d",CASH); //Shows the money that the user still have.

}

}

else

{

printf("Sry, your bet needs to be higher than 20$!");

goto work; //The goto will take him up to the start of the slots.

printf("Your Money at the moment is:%d",CASH); //Shows the money that the user still have.

}

}

}

פורסם

ערוך את ההודעה ושים את הקוד בתוך טג קוד (כפתור עם ציור #) כדי שיהיה קריא.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.