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

פורסם

זה התרגיל:

.מערך מכיל את הציונים של תלמידי כיתה י"א שמתכונת מדעי המחשב.המורה החליטה לתת בונוס לתלמידים ולהעלות את הציונים ב10%. כתוב פעולה המקבלת את מערך הציונים ומעדכנת את המערך בהתאם לנדרש.שימו לב:הציון המקסימלי הוא 100.

וזאת התוכנית שלי:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[] grades = new int[100];
Klita(grades);
Osafa(grades);
Console.WriteLine("the grades are: {0}", grades);

}
static void Klita(int[] grades)
{
// קליטת ציונים למערך
for (int i = 0; i < 30; i++)
{
Console.WriteLine("Enter the students garde");
grades[i] = int.Parse(Console.ReadLine());
}
}
// ט. כניסה: מקבלת מערך מעודכן בציונים
// ט. יציאה: הפעולה תוסיף 10% לכל ציון
static void Osafa(int[] grades)
{
for (int i = 0; i < 30; i++)
{
grades[i] = grades[i] * 110 / 100;
if (grades[i] > 90)
{
grades[i] = 100;
}

}
}

}
}

זה מציג לי את הפלט the grades are: int []32 הבעיה כנראה עם המשתנה ששמתי ב-console.writeline אבל אני לא יודע באיזה משתנה להחליף אותו

תודה יום טוב

פורסם

הבעיה ששמת מערך, פשוט תעבור עליו עם לולאת for ותדפיס את התוכן. גם באיטרציות של ה for תעשה עד grades.Length במקום 30.

התנאי שלך גם לא נכון, פשוט אחרי שאתה מעלה את הציון תעשה Math.Max על הציון החדש ו 100.

ארכיון

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

דיונים חדשים

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.