עבור לתוכן
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.

שאלה

Featured Replies

פורסם

בניתי משחק ניחושים בJAVA

השאלה שלי איך אני מוסיף ניסיונות למשחק שאם אני לא מגלה את המספר שצריך לנחש יש לי עוד ניסיות?

קוד המשחק:

import java.util.Scanner;

class NumberGame

{

public static void main(String args[])

{

System.out.println("chouse namber from 1 to 200?");

System.out.println("write namber:");

Scanner console = new Scanner(System.in);

int y = (int) (Math.random()*200)+1;

int x = console.nextInt();

if (x==y)

{

System.out.print("yes! it is the number!");

System.out.print(y);

}

if (x<y)

{

System.out.print("no! the namber is ");

System.out.print(y);

}

if (x>y)

{

System.out.print("no! the namber is ");

System.out.print(y);

}

}

}

תודה.

פורסם

שלום וברוך הבא לפורום.

תערוך בבקשה את הכותרת כך שתכיל את תמצית השאלה (לחץ על כפתור עריכה בהודעה הראשונה ואז על מצב מתקדם). חוץ מזה, שים את הקוד בתוך טג קוד (כפתור עם ציור #) כדי שיהיה יותר קריא.

פורסם

נסה לכונן את כל הבלוק בתוך לולאת while עם תנאי של כל עוד int number_of_times < 10 (לדוגמה)

ועל כל נסיון number_of_times++

ארכיון

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

דיונים חדשים

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.