5

Is there any way that I can make this program display both text by using Console.ReadLine(); twice?

I provided my code below and whenever I debug I only get the ones provided above the first one, but when I remove the first Console.ReadLine(); everything gets displayed.

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

namespace MyFirstProject
     {
         class Program
             {
                static void Main(string[] args)
                     {

        String name= "John Berr"; 
        String country = "USA";
        String city = "Unknown";
        String age = "15"; 

        Console.WriteLine("My name is " + name);
        Console.WriteLine("The Country I reside in is " + country);
        Console.WriteLine("The city I reside in is " + city);
        Console.WriteLine("I am " + age +" years old");
        Console.ReadLine();


        {
            Console.WriteLine("Hello");
            Console.ReadLine();

        }
      }
   }
}
Community
  • 1
  • 1
amped247
  • 93
  • 7

1 Answers1

2

try put them in a while loop:

var c = "c";

while (c == "c")
{
    Console.WriteLine("Hello");
    Console.WriteLine("press 'c' to continue");
    c = Console.ReadLine();
}
mkf
  • 700
  • 3
  • 12
  • I'll copy and paste so that I can see how the code works though! – amped247 Oct 06 '13 at 03:51
  • I just started today! I need some good books that'll help. I'll google that – amped247 Oct 06 '13 at 03:53
  • 1
    I thumbed you up since I agree! I'm going to wake up early in the morning and work on some c#. I'll return with better questions than this! Thanks for the help – amped247 Oct 06 '13 at 05:07