الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

سويت مشروع وعجزت اكمل ابغى مجرد فكره

بدأه بنوووتة كوووول في 2 يونيو 2010 · 5 رد · 473 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

using System;

using System.Collections;

using System.Text;

namespace project

{

class Program

{

static void main()

{

console.wrireLine("please enter the text consists of two lines or more.");

string s= Console.readLine();

Console.WriteLine("press 1 if you want delete all the space from the end of the text");

Console.WriteLine("press 2 if you wantcopy the text in the text of another variable ")

Console.WriteLine("press 3 if you want input a specific word to calculate the number of times a word appears in the text");

Console.WriteLine("press 4 if you want Calculate the number of phrases in the text");

Console.writeLine(" press5 if you want write "the end" in the end");

Console.WriteLine("press 6 if you want Change all the text characters to lowercase");

Console.WriteLine(" press 7 if you want change all letters of the text to uppercase");

Console.WriteLine("press 8 if you want to replace all the text comma ","");

Console.WriteLine(" press 9 if you want Exit program");

char otion = char . parse(console.Readline() );

switch(choice)

{

case '1':

string1 =string.removeSpace);

break;

case '2':

copy;

break;

انا حليت وماقدرت اكمل ممكن تساعدوني بليز بس لو حتى الفكره..

واذا المكان هنا غلط واين اكتب عطوني الرابط انا هنا جديده ..

ويعطيكم الف عافيه

#2

حلو كذا ممكن نقدر نساعدك ..

حلك تمام كملى باقي الأرقام وضعي الاكواد فيها .. وهاذي اكواد حتفيدك :

1 : لمسح المسافات من نص

string a = Console.ReadLine();
            a = a.Trim();

وإذا بغيتي فقط المسافات الي في البداية :

a = a.TrimStart();

ولمسح المسافات الي في النهاية :

a = a.TrimEnd();
118650.jpg
#3

والأفضل انكي تضعين البرنامج داخل loop من نوع (Do While) واذا ضغط المستخدم رقم 9 يخرج من الـ loop ويسكر البرنامج ..

وكذلك السطور التالية :


Console.WriteLine("press 1 if you want delete all the space from the end of the text");
Console.WriteLine("press 2 if you wantcopy the text in the text of another variable ")
Console.WriteLine("press 3 if you want input a specific word to calculate the number of times a word appears in the text");
Console.WriteLine("press 4 if you want Calculate the number of phrases in the text");
Console.writeLine(" press5 if you want write the end in the end");
Console.WriteLine("press 6 if you want Change all the text characters to lowercase");
Console.WriteLine(" press 7 if you want change all letters of the text to uppercase");
Console.WriteLine("press 8 if you want to replace all the text comma ","");
Console.WriteLine(" press 9 if you want Exit program");

حطيها داخل (Method) فتصبح كالتالي :


{
Console.WriteLine("press 1 if you want delete all the space from the end of the text");
Console.WriteLine("press 2 if you wantcopy the text in the text of another variable ");
Console.WriteLine("press 3 if you want input a specific word to calculate the number of times a word appears in the text");
Console.WriteLine("press 4 if you want Calculate the number of phrases in the text");
Console.WriteLine(" press5 if you want write the end in the end");
Console.WriteLine("press 6 if you want Change all the text characters to lowercase");
Console.WriteLine(" press 7 if you want change all letters of the text to uppercase");
Console.WriteLine("press 8 if you want to replace all the text comma ", "");
Console.WriteLine(" press 9 if you want Exit program");
}
static void PrintMenu()

تستبدلينها بكتابة :

PrintMenu();

تم تعديل هذه المشاركة بواسطة azooz-tamimi في 2 يونيو 2010 في 13:30

118650.jpg
#4

أخ azooz-tamimi وبارك الله فيك وشكرا

وببساطة يكون الكود التالي هو النتيجة :

 static void Main(string[] args)
 	{
 	bool Exit = false;
 	Console.WriteLine("please enter the text consists of two lines or more.");
 	string s = Console.ReadLine();
 	do
 	{
 	Console.WriteLine();
 	Console.WriteLine("press 1 if you want delete all the space from the end of the text");
 	Console.WriteLine("press 2 if you want copy the text in the text of another variable ");
 	Console.WriteLine("press 3 if you want input a specific word to calculate the number of times a word appears in the text");
 	Console.WriteLine("press 4 if you want Calculate the number of phrases in the text");
 	Console.WriteLine(" press5 if you want write \"the end\" in the end");
 	Console.WriteLine("press 6 if you want Change all the text characters to lowercase");
 	Console.WriteLine(" press 7 if you want change all letters of the text to uppercase");
 	Console.WriteLine("press 8 if you want to replace all the text comma , ");
 	Console.WriteLine(" press 9 if you want Exit program");
 	char choice = char.Parse(Console.ReadLine());
 	switch (choice)
 	{
 	case '1':
 	Console.WriteLine("Text after Trim End :");
 	Console.WriteLine(s.TrimEnd());
 	break;
 	case '2': string CopyText = s.Clone().ToString();
 	Console.WriteLine("Text in another variable:");
 	Console.WriteLine(CopyText);
 	break;
 	case '3':
 	Console.WriteLine("Enter the word :");
 	string word = Console.ReadLine();
 	int wordtimes = 0,StartIndex = 0;
 	bool found = false;
 	do
 	{
 	StartIndex = s.ToUpper().IndexOf(word.ToUpper(), StartIndex);
 	if (StartIndex >= 0)
 	{
 	wordtimes++;
 	StartIndex++;
 	found = true;
 	}
 	else
 	found = false;

 	} while (found);

 	Console.WriteLine("Number of times of the Word (" + word + ") in the text = " + wordtimes.ToString());
 	break;
 	case '4'://I think number of Characters 
 	Console.WriteLine("Number of Phrases = " + s.Length.ToString());
 	break;
 	case '5':
 	s = s.Insert(s.Length, " the end.");
 	Console.WriteLine("Text Afte Adding:");
 	Console.WriteLine(s);
 	break;
 	case '6':
 	Console.WriteLine("Text in LowerCase:");
 	Console.WriteLine(s.ToLower());
 	break;
 	case '7':
 	Console.WriteLine("Text in UpperCase:");
 	Console.WriteLine(s.ToUpper());
 	break;
 	case '8':
 	Console.WriteLine("Enter The Char to replace Comma");
 	char CharReplace = char.Parse(Console.ReadLine());
 	Console.WriteLine("Text after replacing:");
 	Console.WriteLine(s.Replace(',', CharReplace));
 	break;
 	case '9':
 	Exit = true;
 	break;
 	}
 	} while (!Exit);


 	}

بالتوفيق :cool:

1338031614581.png

" اللهــم إنّا مغلــوبــون فانتصــــر "

(اللهم سبحانك لا علم لنا إلا ما علمتنا إنك أنت العليم الحكيم)

#5

بارك الله فيك اخي مابقيت شي :) .. بس حبيت انبه على نقطه انه انا وانت نستطيع عمل هاذي البرامج بكل سهولة وفي أقل من خمس دقائق !

وماوصلنا لهذي الدرجة إلى من من اجتيازنا الكثير من العقبات والمشاكل :) .. فليس من الجيد للأخت الكريمة أنها تعتمد على غيرها في كتابة الكود كامل! ولابأس ببعض المساعدة ..

لكن من الأفضل ترك المشاكل لصاحبها ليحلها بنفسه وحنا نساعده .. بارك الله فيك ..

118650.jpg
#6

معك حق اخي صحيح ولك كما قلت لم يأخذ معنا اكثر من خمس دقائق.. كنت اتسلى به :happy: لان هذا لا يتعدى واجب من الواجبات الصغيرة التي كنا نحلها في الجامعة

طبعا لن نحل كل المشاريع هكذا .. تتفق معي أكيد ..:wink:

تم تعديل هذه المشاركة بواسطة was_hal في 2 يونيو 2010 في 14:33

1338031614581.png

" اللهــم إنّا مغلــوبــون فانتصــــر "

(اللهم سبحانك لا علم لنا إلا ما علمتنا إنك أنت العليم الحكيم)

مواضيع مشابهة