Need help with this project

1. Declare two integers, one for row number entered one for the number of columns entered
2. Declare a string variable named dummy it will be used for the ending prompt.
3. Display the title [item #1] using Console.Writeline()
4. Display a blank line [2] using Console.Writeline()
5. Display an input prompt [3] using Console.Write()
6. Accept the number of rows using Console.Readline()
7. Display an input prompt [4] using Console.Write()
8. Accept the number of columns using Console.Readline()
9. Display a blank line [5] using Console.Writeline()
10. Display tab “/t” using Console.Write() [6] – this create a column for the row header.
11. In a FOR…LOOP display the number from 1 to columns. [6] Inside your Console.WriteLine() use the “/t”.
12. Display a blank line [7] using Console.Writeline()
13. Using nested for…loops to produce the matrix [8]. The “outer” for…loop counts the number of rows, the inner for…loop counts the number of columns.
14. Display a blank line [9] using Console.Writeline()
15. Display ending prompt [10].

So what have you done so far? It looks like step-by-step instructions on what to write, so I'm not sure what problems you are having.

One way to do this is to turn each of the instructions you have there into comments, then write the code for each comment:

// 1. Declare two integers, one for row number entered one for the number of columns entered
... code that declares two integers goes here ...

// 2. Declare a string variable named dummy it will be used for the ending prompt.
... code that declares string variable goes here ...

// 3. Display the title [item #1] using Console.Writeline()
... etc ...

// 4. Display a blank line [2] using Console.Writeline()
// 5. Display an input prompt [3] using Console.Write()
// 6. Accept the number of rows using Console.Readline()
// 7. Display an input prompt [4] using Console.Write()
// 8. Accept the number of columns using Console.Readline()
// 9. Display a blank line [5] using Console.Writeline()
// 10. Display tab “/t” using Console.Write() [6] – this create a column for the row header.
// 11. In a FOR…LOOP display the number from 1 to columns. [6] Inside your Console.WriteLine() use the “/t”.
// 12. Display a blank line [7] using Console.Writeline()
// 13. Using nested for…loops to produce the matrix [8]. The “outer” for…loop counts the number of rows, the inner for…loop counts //     the number of columns.
// 14. Display a blank line [9] using Console.Writeline()
// 15. Display ending prompt [10].

Edited 6 Years Ago by Momerath: n/a

Here is what I have so far I have problem getting space after user prompt and I have error bottom of code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to My Table Software");

            Console.WriteLine("");

            Console.Write("Enter the number of rows");
            int numrows = Convert.ToInt16(Console.ReadLine());
            Console.Write("Enter the number of columns");
            int numcols = Convert.ToInt16(Console.ReadLine());
            {
                for (int row = 1; row <= numrows; row++)
                {
                    Console.Write(row + "\t");
                }
                for (int col = 1; col <= numcols; col++)
                {
                    Console.Write(col + "\t");
                    {
                        Console.Write(row * col + "\t");
                    }
                    Console.WriteLine();
                }
            }
        }
    }
    }

Edited 3 Years Ago by Dani: Formatting fixed

This article has been dead for over six months. Start a new discussion instead.