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

פורסם

אני אמור לקלוט תאריך בפורמט dd/mm/yyyy ולהחזיר פלט של 3 int's של התאריך (יוםת שעה ושנה)

אני אמור לכתוב את התרגיל במתודה, כתבתי משהו אבל יש לי בעיות בהמשך, המתודה שלי מקבת את הסטרינג בפורמט dd/mm/yyyy, ממירה את הסטרינג ל-int ומכניסה את ה-3 int's למערך, מעכשיו הבעיות שלי מתחילות, איך אני רושם בהמשך שידפיס לי את כל ה-int's למסך ?

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


namespace T266B
{
class Program
{


//define method
static int stDate(string date)
{


int ArrayIndex = 0;
string temp = "";


//define array
string[] stArray = new string[3];
int[] NumArray = new int[3];


//seperate the date to day, month, year, convert to int and put into array
for (int i = 0; i < date.Length; i++)
{
if (date[i] != '/' & date[i] != ' ')
{
temp += date[i];
}
else if (temp != " ")
{
int Number = int.Parse(temp);
NumArray[ArrayIndex] = Number;
Number = 0;
temp = "";
ArrayIndex++;
}
}


return 0;
}


static void Main(string[] args)
{
//read date
Console.Write("Enter Date (dd/mm/yyyy): ");
string date = Console.ReadLine();
date = date + " ";


int result = stDate(date);








}
}
}

פורסם

int[] convertDate()
{
random code;
...
int[] temp = new int[3];
temp[0] = Convert.ToInt32(ddstr);
temp[1] = Convert.ToInt32(mmstr);
temp[2] = Convert.ToInt32(yystr);
return temp;
}

וכדי להדפיס אח"כ פשוט רוץ עם לולאה על המערך המוחזר ותדפיס כל ערך.

מה גם שאני לא רואה איפה אתה מחזיר אצלך משהו חוץ מאפס..

ארכיון

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

דיונים חדשים

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.