// Program displays every possible ID number for a company
// ID number is a letter, followed by a two-digit number
// For example -- A00 or Z99
// Go to a new display line after every 20 IDs
using System;
public class DebugSix3
{
public static void Main()
{
char letter;
int number;
const int LOW = 0;
const int HIGH = 99;
const int NUMINROW = 20;
for (number = LOW; number <= HIGH; ++number)
{
if (number % NUMINROW == 0)
Console.WriteLine();
Console.Write("{0}{1} ", letter, number.ToString("D2"));
}
}
}
C# Debugging homework easy application
Page 1 of 17 Replies - 1250 Views - Last Post: 26 March 2012 - 10:37 PM
#1
C# Debugging homework easy application
Posted 25 March 2012 - 05:23 PM
Cant figure out what is wrong with local variable "letter". Needs to show letters A-Z
Replies To: C# Debugging homework easy application
#2
Re: C# Debugging homework easy application
Posted 25 March 2012 - 06:04 PM
You never assign letter a value.
#3
Re: C# Debugging homework easy application
Posted 26 March 2012 - 02:05 AM
If I understood you correctly, you want to display every letter + the number 1-99, from A-Z?
If not, ignore the code below:
[removed code]
If not, ignore the code below:
[removed code]
This post has been edited by tlhIn`toq: 26 March 2012 - 07:09 AM
Reason for edit:: We don't provide finished code for homework
#4
Re: C# Debugging homework easy application
Posted 26 March 2012 - 03:23 AM
Hiya, a bunch of tutorials here you can read and follow on debugging. They're under the "spoiler" cut right at the top. Essential skill to learn!
With a breakpoint in place you can hover the mouse over the "letter" variable and see exactly what value it contains. Which in the case of your code, please go and check, should be null as you have never assigned "letters" to anything.
letter = A; Assigning "letter" to A.
http://www.dreaminco...cle-you-wanted/
TenderFoot not sure about writing out the whole program like that... rookies need to learn to think through and plan out their applications themselves.
With a breakpoint in place you can hover the mouse over the "letter" variable and see exactly what value it contains. Which in the case of your code, please go and check, should be null as you have never assigned "letters" to anything.
letter = A; Assigning "letter" to A.
http://www.dreaminco...cle-you-wanted/
TenderFoot not sure about writing out the whole program like that... rookies need to learn to think through and plan out their applications themselves.
This post has been edited by negligible: 26 March 2012 - 03:30 AM
#5
Re: C# Debugging homework easy application
Posted 26 March 2012 - 06:06 AM
@Tenderfoot, don't do people's homework for them. That doesn't help anyone.
#6
Re: C# Debugging homework easy application
Posted 26 March 2012 - 10:36 AM
I did try to explain as I went on - but I get your point and it won't happen again.
#7
Re: C# Debugging homework easy application
Posted 26 March 2012 - 06:15 PM
I'm sorry for posting my 'homework', actually i figured almost all of it out already, there was just a small problem for which i needed some help. Thank you to everybody how tried to help me, i got it now though
#8
Re: C# Debugging homework easy application
Posted 26 March 2012 - 10:37 PM
For future reference, we don't mind helping with homework. We usually enjoy it. We just don't do the work for people. It's not constructive, because our philosophy isn't to solve problems, but to make better programmers.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|