|
|
מסכים עם ישראל שללמוד שפה באינטרנט זה ממש לא חכם
אני מבין תמשתנים
אבל כשאני מנסה לעשות ניסיון לדוגמה ניסיתי לעשות קוד
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
string user = Console.ReadLine();
if (user => "Yuval");
{
Console.Write("What is your name?" );
Console.Write("You are Correct" );
}
}
}
זה לא עובד..
תיראה זה הקוד שיעבוד
אבל השאלה מה אתה רוצה לעשות הפלט הראשון צריך להיות לפני הקליטהקוד:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string user = Console.ReadLine(); if (user == "Yuval") { Console.Write("What is your name?"); Console.Write("You are Correct"); } } } }
מה שניסיתי לעשות היה שיהיה כתוב בCMD What is your name ורק עם אני כותב Yuval אז זה כותב לי You are correct
עריכה:
הצלחתי
זה הקוד שיצא לי:
קוד:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.Write("What is your name:"); string user = Console.ReadLine(); if (user == "Yuval") Console.WriteLine("you are correct "); { } } } }
סבבה אז זה לפי הסדר
פלט:מה השם שלך
קלט לתוך user
תנאי בדיקה אם קלט שווה ליובל
בתוך התנאי אתה רושם את you are correct
תלמד עוד קצת על הפרק של תנאים