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

פורסם

שלום,

קיבלתי מטלה לכתוב תכנית : עלי להכניס 4 מספרים ועל התוכנית לבצע סכום של המספרים וממוצע. מה שקורה שזה עובד רק המסך השחור עף מיד אחרי שהתוצאה מוצגת להלן התוכנית:

roject1.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <iostream.h>

#define MAX_NUMBERS 4

int main(int argc, char* argv[])

{

int i;

double Numbers[MAX_NUMBERS];

double sum, average;

sum = 0.0;

average = 0.0;

for ( i = 0; i < MAX_NUMBERS; i++ )

{

cout << "Please enter number " << i+1 << " (press enter to continue): ";

cin >> Numbers;

sum += Numbers;

}

average = sum / MAX_NUMBERS;

cout << "The sum of the numbers is: " << sum << endl;

cout << "The average of the numbers is: " << average << endl;

cout << "Press any key to exit";

return 0;

}

פורסם

מה בדיוק אתה רוצה שיקרה? הדפסת press any key to exist אבל אין אחרי זה פקודה שמחכה לקלט כלשהו.

פורסם
  • מחבר

אתה יכול לעזור לי איך זה אמור להיות???

פורסם

הכי פשוט זה cin לתוך איזה משתנה סתמי חסר-משמעות (אבל אז תצטרך ללחוץ enter ולא סתם כל מקש).

פורסם

או פשוט ()cin.get

אגב, זה לא C אלא ++C.

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

ארכיון

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

דיונים חדשים

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.