So im having great difficulty trying to have my program move onto the GetInput() methods and so on ...can anyone point me in the right direction and tell me whats going on?

write a program that allows any number of values between 1 and 10 to be entered.
When the user stops entering values, display a bar chart using asterisks showing the number of
times each value was entered. When a given number is not entered, no asterisk should appear on that line

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

namespace barChart
{
    class Program
    {

        static List<int> myIntegers = new List<int>();
        static void Main()
        {
            string userString;

            int[] integers = new int[] {1, 2 ,3 ,4, 5, 6, 7 ,8 ,9 ,10
            };

            DisplayInstructions();
             
        } // end of main 

        public static void DisplayInstructions()
        {
            Console.Write("In this program you will be allowed to enter any number of values between 1 and 10 " +

                            " when the you stop entering values , a bar chart will be displayed using \nasterisks" +

                            " showing number of times each value was entered" +

                            "\n\nPlease press any key to continue......");
            Console.ReadKey();
          //  Console.Clear();

        } // end of DisplayInstructions 

        public static string GetInput()
        {
            string input = "";
            Console.Write("Please enter a value: ");
            while (char.ToLower(Console.ReadKey(true).KeyChar) == 'y')
            {
                Console.Write("Would you like to enter additional values? Y/N ");
            }
            if (myIntegers.Count != 0)
                DisplayChart();
            else

                Console.WriteLine(Environment.NewLine + "Program end, no user input");

            return input;


        } // end of GetInput 

        public static string ConvertToChar(int[] integers)
        {
            string input = "";

            for (int i = 0; i < integers.Length; i++)
            {
                Console.Write("Enter Number {0}: ", i + 1);
                input = Console.ReadLine();
                integers[i] = Convert.ToChar(input);

                //input.ToCharArray((char)*); 

                //Convert.ToChar(<string>);
            } 
            return input;

            ////userString = Console.ReadLine(); 
            ////char[] myChar = userString.ToCharArray();


        }

        public static void DisplayChart()
        {
            Console.Write("\n");
            Console.WriteLine("Your Results: ");
            Console.WriteLine("-------------  ");
            Console.WriteLine();
           


        } // end of DisplayChart 
    } // end of class 
} // end of namespace

thank you very much I am a noob :) , Im modifying it but I still cant seem to get my program to move past a DisplayInsructions() and start the user input method

You have not called the other functions in your code FROM main.
The only method you're calling is DisplayIntructions();

Also, how is the program supposed to detect the user has stopped entering values?

Something like this might help:

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

namespace DW_412384_CS_CON
{
   class Program
   {
      static void Main(string[] args)
      {
         string strInput = "";

         Console.WriteLine("Enter a number from 1 to 10.  -1 to quit");
         while (!strInput.Equals("-1"))
         {
            Console.Write(": ");
            if ("-1" == (strInput = Console.ReadLine()))
               continue;
         }
      }
   }
}

Edited 4 Years Ago by thines01: added code

Ok so with the amazing help from everyone I have got to the point finally where my input is being recieved..one last issue I have is I need the user to be able to enter as many values between 1 through 10 and in the end a bar chart will display asterisks corresponding to the number of times a input was entered. Question i have included a new block of code (While loop) which will ask the user if they want to enter more...should i take the previous while loop so this can prompt the user?

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

namespace ConsoleApplication1
{
    class userChart
    {
         static List<int> myIntegers = new List<int>();
         static void Main()
         {
             //declare array 
             int[] integers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 19 };
             string strInput = "";
             bool data = true; 
             Console.WriteLine("Enter a number from 1 to 10.  -1 to quit");

             while (!strInput.Equals("-1"))
             {
                 Console.Write(": ");

                 if ("-1" == (strInput = Console.ReadLine()))

                     continue;

             } // end of while 

             while (data)
             {
                
                 Console.Write("Do you want to create another table (y/n)?");
                 strInput = Console.ReadLine();
                 if (strInput == "y" || strInput == "Y")
                 {
                     Console.Clear();
                 }
                 else
                     data = false;
             }

                                              
                 //
                 List<float> BinList = new List<float>();

                 BinList.Add(1f);

                 BinList.Add(2f);

                 BinList.Add(3f);

                 BinList.Add(4f);

                 BinList.Add(5f);

                 BinList.Add(6f);

                 BinList.Add(7f);

                 BinList.Add(8f);

                 BinList.Add(9f);

                 BinList.Add(10f);

                 DrawBarChart(BinList);

                 Console.ReadKey();

              // end of while loop 
         }// end of main
                
 
        static void DrawBarChart(List<float> LF)

        {

            // calculate maximum of the data

            float max = 0;  

            for (int i = 0; i < LF.Count; i++)

            {

                if (LF[i] > max) max = LF[i];

            } // end of for loop 

            // draw chart

            Console.WriteLine('|');

            for (int i = 0; i < LF.Count; i++)

            {

                Console.Write('|');

                for (int j = 0; j < (int)(LF[i]/max * 25f); j++)

                {

                    Console.Write('#');

                } // end of inner for loop 

                Console.WriteLine();

            } // end of outer for loop 

            Console.WriteLine('|');

        } // end of DrawBarChar 

    } // end of  class 

} // end of namespace

Inside the while loop with strInput, you need to put the result of what the user enters into your list (or array) if it fits the criteria.

If it does not, ignore it.

If it is a -1, you can exit and print the graph.

Also, if you pre-fill the tally array (or list) with the digits from 1-10, you can use one-off math to do the count and not have to keep track of which numbers were not used.

So, if the user enters the same number multiple times and does not enter other numbers, you probably still have to show the other numbers with zero asterisks, right?

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