Thank you
🔒 Locked
Am I Ready?
Advertisement
Original Post
I have been reading through a book on C# and i was wondering if you think i am ready to start writing extremely basic programs. I have been doing the examples in the book and trying not to move on in the book untill i am reasonably comfortable with what i have just read. (Also, this may sound like a noob question, but what programs should i start off with?)
Thank you
Thank you
I have been reading through a book on C# and i was wondering if you think i am ready to start writing extremely basic programs.
Yes. Give it a try!
(Also, this may sound like a noob question, but what programs should i start off with?)
Thank you
Depends on what you've learned so far. Off the top of my head:
Some very basic string manipulation, to practice input/output, loops, and a few standard library methods:
1. Ask for a name, user enters a name, output the the name in all capital letters
2. As above, except output each letter separately then pause until the user hits the enter key
3. As above, but output the letters backwards, or in alphabetical order, or shuffle them randomly
4. Create a simple database, where the user enters names and phone numbers. If the user hits enter without entering a name, ask for a name, and then output the associated phone number previously entered
5. As above, but save the name/number data to a text file.
A simple game might be a guess-the number, where after each guess the program outputs "higher" or "lower" until the user guesses correctly (or only give the user a fixed # of guesses before loosing).
One of my favorites:
XXXXXXXX
AAAXXXXX
XXAAAXXX
XXXXAXXX
XXAAAXXX
XXAXXXXX
XXAAAAAA
XXXXXXXX
Put the above 8x8 matrix in the text file. Starting at the first A, write a generic program to find a way from the the A in the first column to the A in the last column. Of course, you'll have to assume that there are no loops and first and last row only has one A each to keep it simple. At the end you must print out the number of A's to get to the end. Recursion is a very important concept and I think this is a very good exercise for that.
XXXXXXXX
AAAXXXXX
XXAAAXXX
XXXXAXXX
XXAAAXXX
XXAXXXXX
XXAAAAAA
XXXXXXXX
Put the above 8x8 matrix in the text file. Starting at the first A, write a generic program to find a way from the the A in the first column to the A in the last column. Of course, you'll have to assume that there are no loops and first and last row only has one A each to keep it simple. At the end you must print out the number of A's to get to the end. Recursion is a very important concept and I think this is a very good exercise for that.
A text based calculator might work pretty well. You learn how to handle inputs pretty well from it in my opinion and you can do it very early on while learning to program.
I have been reading through a book on C# and i was wondering if you think i am ready to start writing extremely basic programs. I have been doing the examples in the book and trying not to move on in the book untill i am reasonably comfortable with what i have just read. (Also, this may sound like a noob question, but what programs should i start off with?)
Ready are you, young Jedi! You could start with a text-based Higher or Lower card game. This would involve making both a data structure to represent a single card and one for representing a deck (which would manage 52 card structures), being able to represent each of them on the screen (for example "9C" for "9 of clubs"), and compare them to find out which has the higher value -- all in all a good, little beginner's project that will teach you some basic principals of game programming.
I have been reading through a book on C# and i was wondering if you think i am ready to start writing extremely basic programs. I have been doing the examples in the book and trying not to move on in the book untill i am reasonably comfortable with what i have just read. (Also, this may sound like a noob question, but what programs should i start off with?)
Thank you
Dude you don't realy learn from reading you learn from writing the code.. Just give it a try!
Myself when i started learning java i tried to make my own swing applications and i had great fun with it also and it helped me learn alot!
So realy my advice is just go for the console applications if you never realy coded before.
Another good exercise is to read in your own source file and output the comments in the file only and replace all the rest with spaces. This learns you somthing about state machines and file parsing, remeber that C# has // and /**/ as comment syntax.
Never underestimate the educational value of Pong. Don't even worry about graphics yet, just learn how to clear the screen quickly, and redraw the paddle and ball with ascii characters.
As you learn new things like graphics, sound, or networking, you can add them to your Pong game... you can basically start at zero and (if you stick with it) incrementally improve things until you have a professional-looking game. Sticking with one game and improving it over time will also teach you a lot about code re-use, which plenty coders don't really grasp until they've been writing code for a year or two.
As you learn new things like graphics, sound, or networking, you can add them to your Pong game... you can basically start at zero and (if you stick with it) incrementally improve things until you have a professional-looking game. Sticking with one game and improving it over time will also teach you a lot about code re-use, which plenty coders don't really grasp until they've been writing code for a year or two.
Thanks for all your suggestions, i will try to attempt them all!
I am having trouble with #2, I dont know how to do it, i have tried looking but i have found nothing yet Can anyone give me a hint on how i could do it please?
Depends on what you've learned so far. Off the top of my head:
Some very basic string manipulation, to practice input/output, loops, and a few standard library methods:
1. Ask for a name, user enters a name, output the the name in all capital letters
2. As above, except output each letter separately then pause until the user hits the enter key
3. As above, but output the letters backwards, or in alphabetical order, or shuffle them randomly
4. Create a simple database, where the user enters names and phone numbers. If the user hits enter without entering a name, ask for a name, and then output the associated phone number previously entered
5. As above, but save the name/number data to a text file.
A simple game might be a guess-the number, where after each guess the program outputs "higher" or "lower" until the user guesses correctly (or only give the user a fixed # of guesses before loosing).
I am having trouble with #2, I dont know how to do it, i have tried looking but i have found nothing yet Can anyone give me a hint on how i could do it please?
[quote name='laztrezort' timestamp='1312249203' post='4843390']
2. As above, except output each letter separately then pause until the user hits the enter key
I am having trouble with #2, I dont know how to do it, i have tried looking but i have found nothing yet Can anyone give me a hint on how i could do it please?
[/quote]
Hint: You can use a string like an array of chars.
Am i being stupid? I still can't do it All i can find is how to split string that have commas in, but none about splitting a word
No, you are not stupid; programming can be very difficult in the beginning when you are unfamiliar with even the most basic principals. If you list your program so far I may be able to give you a few guideline =)
[quote name='melloorr' timestamp='1312309820' post='4843697']Am i being stupid? I still can't do it All i can find is how to split string that have commas in, but none about splitting a word
No, you are not stupid; programming can be very difficult in the beginning when you are unfamiliar with even the most basic principals. If you list your program so far I may be able to give you a few guideline =)
[/quote]
This is what i have got for # 1 and 3:
using System;
class BasicProject1
{
static void Main()
{
string name, nameUp, nameBack;
Console.Write("Please enter your name: ");
name = Console.ReadLine();
nameUp = name;
nameUp = nameUp.ToUpper();
nameBack = name;
Console.WriteLine("Your name in capitals is: " + nameUp);
Console.Write("Your name backwards is: ");
for (int i = 0; i < nameBack.Length; i++)
{
Console.Write(nameBack[nameBack.Length -i - 1]);
}
Console.ReadLine();
}
}
This is what i have got for # 1 and 3:
using System;
class BasicProject1
{
static void Main()
{
string name, nameUp, nameBack;
Console.Write("Please enter your name: ");
name = Console.ReadLine();
nameUp = name.ToUpper(); // string.ToUpper returns a copy of the string so I merged the two lines
nameBack = name;
Console.WriteLine("Your name in capitals is: " + nameUp); // Good! Task #1 complete <img src='http://public.gamedev.net/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' />
// I am not going to solve #2 for you, but here is a tip:
// Console::ReadKey(Boolean) will read the next keystroke by the user, including function keys,
// and if you set the Boolean value to "true" it will not output the read character on the screen.
Console.Write("Your name backwards is: ");
// When you are dealing with strings (that fall into the category "things that may change at run-time")
// it is usually a good idea to assign its length to a local variable when accessing each character in turn
// before you start the for-loop like this:
//
// int i,n=nameBack.Length;
//
// for(i=0;i<n;i++)
// {
// ...
// }
for (int i = 0; i < nameBack.Length; i++)
{
Console.Write(nameBack[nameBack.Length -i - 1]);
}
Console.ReadLine();
}
}
Another hint for #2: Watch what happens in your loop that prints the name backwards. Put a breakpoint inside the loop and watch your output each time you step through the loop. It prints out one letter at a time, right? You should be able to add something else inside the loop which makes it wait in a similar way to the breakpoint (previous people have hinted how to do this).
Another hint for #2: Watch what happens in your loop that prints the name backwards. Put a breakpoint inside the loop and watch your output each time you step through the loop. It prints out one letter at a time, right? You should be able to add something else inside the loop which makes it wait in a similar way to the breakpoint (previous people have hinted how to do this).
Thanks! I finally done it! Well im pretty sure i have
using System;
class BasicProject1
{
static void Main()
{
string name, nameUp, nameBack;
// Task One
Console.Write("Please enter your name: ");
name = Console.ReadLine();
nameUp = name.ToUpper();
nameBack = name;
Console.WriteLine("Your name in capitals is: " + nameUp);
// Task Two
int s = name.Length;
for (int i = 0; i < s; i++)
{
Console.Write(name);
Console.ReadKey(true);
continue;
}
// Task Three
Console.Write("\nYour name backwards is: ");
int n = nameBack.Length;
for (int i = 0; i < n; i++)
{
Console.Write(nameBack[nameBack.Length -i -1]);
}
Console.ReadLine();
}
}
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement