Design and perform an experiment to determine the size of the longest string that C# will allow you to create.
Write a program that reads two strings S and T, each on its own line. The program should print "true" if S starts with T, "false" otherwise. Do not use any library functions.
Write a program that reads a single line containing an integer which may be arbitrarily large, and writes the integer with embedded commas.
Input:
28470562348756298345
Output:
28,470,562,348,756,298,345
Write a program that reads a sequence of integers on a single line. The sequence is guaranteed to contain at most two distinct values. For example, it might be
17 17 17 11 17 11 11 11 17 11 17 11 11
The program should print out the sequence in sorted order:
11 11 11 11 11 11 11 17 17 17 17 17 17
How efficient is your program?
We know that in C# the 'int' type represents a signed 32-bit integer.
a) Pretend that you know that 'int' is signed, but don't know how many bits it has. Write a program that will determine the size of 'int' experimentally, and will write output such as
32 bits
b) Modify and rerun your program to determine the size in bits of the signed C# type 'long'.
In the game of Wordle, one player (A) thinks of a
5-letter English word. The other player (B) tries to deduce the word
by making a series of guesses, each of which must be a 5-letter
English word. After each guess, player A reveals which letters are
green, i.e. they are correct and in the correct position, and
which are yellow, i.e. they are correct, but not in the
correct position. For example, if the word is SNAIL
and the guess is SPIKE
, then the S is
green and the I is yellow. Player B must guess the word within 6
attempts, otherwise the game is lost.
Write a program that chooses a random word and lets the user try to guess it. The program should print each of the user's guesses with green or yellow letters as appropriate.
Here is a dictionary of 5-letter words in English that your progam can use.
Write a program that can play Wordle. The user
will think of a 5-letter English word and the program will try to
guess it. After each guess, the user should enter a 5-character
string such as g_yy_
, where 'g'
indicates a green letter and 'y' indicates a yellow letter.