CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    8

    Simple C# Programming doubt (Beginner)

    I am building a program with Name, Roll No., Marks in different subjects, Total and Average.........I haven't yet finished and before that I have some doubts. Please help


    class Report


    {
    static void Main ()

    {

    string s = " ";
    int a;
    /*,c,d,e,f,g,h,i;*/

    Console.WriteLine ("Enter the Name:");
    s= Console.ReadLine ();

    Console.WriteLine ("Enter the Roll No.:");
    a=Convert.ToInt32(Console.ReadLine ());

    /*
    Marks in English:\nMarks In Hindi:\nMarks in Maths:\nMarks in Social:\nMarks in G.K.:\n");



    b=Convert.ToInt32(Console.ReadLine ());
    c=Convert.ToInt32(Console.ReadLine ());
    d=Convert.ToInt32(Console.ReadLine ());
    e=Convert.ToInt32(Console.ReadLine ());
    f=Convert.ToInt32(Console.ReadLine ());
    g=Convert.ToInt32(Console.ReadLine ());
    h=Convert.ToInt32(Console.ReadLine ());
    i=Convert.ToInt32(Console.ReadLine ());*/

    }

    }


    When I am asked to enter name it is not coming on the side ways

    it is coming like this

    Enter the Name:
    Jonah


    I want it to come in this way

    Enter the Name: Jonah


    please help what I must do to make my input name to be typed just beside " Enter the Name:" instead of next line.

    thanks

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Simple C# Programming doubt (Beginner)

    Change

    Code:
    Console.WriteLine ("Enter the Name:");
    to

    Code:
    Console.Write("Enter the Name:");
    WriteLine writes a line : i.e. inserts a newline at the end of the text.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    Jul 2009
    Posts
    8

    Re: Simple C# Programming doubt (Beginner)

    Thanks dude.

    Thank You Very Much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured