Jump to content

Archived

This topic is now archived and is closed to further replies.

nyac55

Rozwiązany: C# - problemy z prostymi programami?

Recommended Posts

Witam. Mam do wykonania program ,który prosi użytkownika o podanie 2 łańcuchów tekstowych w języku C#. To udało mi się zrobić ,lecz teraz z tych wyrazów muszę stworzyć 1 wypadkowy z odwróconą kolejnością liter i tutaj zaczyna się problem ,bo nie wiem jak to poprawnie zrobić. Proszę o pomoc?

Przykładowo:

wyraz 1: ala

wyraz 2: makota

wyraz wypadkowy od tyłu: alaatokam.

Ktoś może mi pomóc w napisaniu tego??

_+_+_+_+_

Obecnie mam coś takiego:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string a,b;
Console.WriteLine("Zostaniesz poproszony o podanie 2 ciagów znaków");
a=Console.ReadLine();
b=Console.ReadLine();

Console.WriteLine(a);
Console.WriteLine(a + b);
Console.ReadKey();
}
}
}

Link to comment
Share on other sites

Wynik:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string a,b;
Console.WriteLine("Zostaniesz poproszony o podanie 2 ciagów znaków.");
Console.WriteLine("Podaj 1 ciąg:");
a=Console.ReadLine();
Console.WriteLine("Podaj 2 ciąg:");
b=Console.ReadLine();
string c = new string(a.Reverse().ToArray());
string d = new string(b.Reverse().ToArray());
Console.WriteLine("Twoj wynik to:");
Console.WriteLine(c+d);
Console.ReadKey();
}
}
}

Program działa poprawnie. Dzięki za pomoc.

____________________________

Proszę nie zamykać jeszcze tematu ,bo będę potrzebował jeszcze pomocy.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...