YO I NEED HELP writing a code need advice not for u to write it for me
write me a c# program that get 3 latters and tell if they are by the order like abc if they are backward like cba or if they are random like ami
17 Replies
help
mb worng quition
i need a c# program that get 3 latters and tell if they are by the order like abc if they are backward like cba or if they are random like ami
We won't write it for you
$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Specifically in this case, please post your code.
i need how to like do the letter shit i know the rest
1. What does "get 3 letters mean"? Allow the user to input 3 letters in the console? Randomly Generate 3 letters? etc.
2. Are there only 3 possible outputs? in-order, reverse-order, no-order?
like u get abc and program need to say
u get 3 letter
and that the only 3 outpot
how do you get three letters? do you already have that code written? are you doing
Console.ReadLine()
to get the letters?
can you share your codein put are 3 letters
output in-order, reverse-order, no-order
can you share your current code? that will be the easiest way for us to help
$codegif
using System;
class Program
{
static void Main()
{
//need to get letter and do the order part
if (first < second && second < third)
{
Console.WriteLine("The letters are in ascending order (like abc).");
}
else if (first > second && second > third)
{
Console.WriteLine("The letters are in descending order (like cba).");
}
else
{
Console.WriteLine("The letters are in random order.");
}
}
else
{
Console.WriteLine("Invalid input. Please enter exactly three letters.");
}
}
}
you should start with the
//need to get letter and do the order part
it will be easier to test the rest of your code if you do that first
is that what you are asking for help on?
because your logic of your if
statements looks like you are on the right track at first glance 🙂Console.Write("numer 1:");
int num3 = int.Parse(Console.ReadLine());
Console.Write(numer 2");
int num2 = int.Parse(Console.ReadLine());
Console.Write("number 3");
int num1= int.Parse(Console.ReadLine());
to get number and how to do the output
how to like do the order shit?
you don't necessarily need to do the
int.Parse
you do that if you need to convert he value into an integer
you don't sound like you need to do that for your codethat like to get the number
how to do the order
you are so close that I'll give you this possible example
that example jsut has the user provide all 3 characters in one
Console.ReadLine
and it splits the characters into seperate variables from the input string
you can get individual char
s from a string
using the indexer. myString[...]
where ...
is the index of the char to get from the string
input.Trim()
is a helper method that will remove white space on the front and end of the string, so if the user inputs " abc "
instead of just "abc"
the code will still allow it
you don't necessarily need to include the .Trim()
if you don't want to. it is just generally a good practice