עבור לתוכן
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 ? (לתפריט למשל)

פורסם

איך אני אני קולט תו אחד ב C ? (לתפריט למשל)

תעבור על פקודות conio.h

תשתמש ב

getch()

או משהו בסגנון, מזמן לא התעסקתי עם זה

פורסם

getch()=X

X הוא משתנה.

פורסם

getch()=X

X הוא משתנה.

רק שזה הפוך כמובן... x=getch() 1

אל תשים לב ל '1' הוא פשוט בשביל שהסוגריים יופיע בצד הנכון...

פורסם

על יישור לשמאל שמעתם?

פורסם

char x;
scanf("%c",&x);

מספיק טוב..? =]

פורסם

במקרה הזה הפונקציה תחכה ל- enter לפני שהיא תחזור.

(עריכה)

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

אם אתה כן צריך לעשות משהו, אתה צריך קודם לבדוק אם נלחץ מקש (למשל עם kbhit ב- conio.h) או שב- windows - יש לך אפשרות לשאול האם מקש מסוים נלחץ עם GetAsyncKeyState.

פורסם


#include <conio.h>

void main(){
int game = 1;
char bla;

while(game)
{
while(!kbhit())
{/*Animation Comes Here*/}
bla = getch();

if(bla == 'e')//as in exit
game = 0;

}
}

או


void main()
{
int game=1;
chat input=0;

while(game)
{
//do animation
if(kbhit())
{
input=getch();
if(input=='e')
game=0;
}

}


לפי דעתי השיטה השניה יותר טובה, אבל זה כבר טעם אישי.

ארכיון

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

דיונים חדשים

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.