| | |
Simple C# Programming doubt (Beginner)
Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2009
Posts: 3
Reputation:
Solved Threads: 0
I am building a program with Name, Roll No., Marks in different subjects, Total and Average. Just wanted some advice. Pls encourage me.
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
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
3
#4 Oct 16th, 2009
No, ddanbe is correct. If you use
Change those to
Console.Write() then read the line it will not advance the cursor to the next line. You probably made modifications to the wrong section of the code. Here are the lines in question: C# Syntax (Toggle Plain Text)
Console.WriteLine ("Enter the Name:"); Console.WriteLine ("Enter the Roll No.:");
Change those to
Console.Write(); and please be careful when telling ddanbe when is wrong. He usually isn't. 0
#6 Oct 16th, 2009
@jonahmano: ddanbe you are wrong.
No. He gave you a solution. Use Write Method.
No. He gave you a solution. Use Write Method.
C# Syntax (Toggle Plain Text)
Console.Write("Enter Name : "); value=Console.ReadLine();
Failure is not fatal, but failure to change might be. - John Wooden
0
#8 Oct 16th, 2009
Please mark this thread as solved as danny provided a solution to your question and good luck!
If you are still having issues please post back on this thread and we will be more than happy to help you.
If you are still having issues please post back on this thread and we will be more than happy to help you.
![]() |
Similar Threads
- Simple Programming for Desktop Application (IT Professionals' Lounge)
- Please Review My Programming Website : freejavaguide.com (Website Reviews)
- Python - Card Class - Graphics Win (Python)
- PHP/MySQL Programming (PHP)
- Simple Programming Errors (Computer Science)
- how to understand a program (Computer Science)
Other Threads in the C# Forum
- Previous Thread: A tcp ip client using C#
- Next Thread: Maintaining sync between two dropdownlists
| Thread Tools | Search this Thread |
.net 3.5 access activedirectory algorithm app array asp.net basic beginner buttons c# c++ camera check client code combobox commerce connect contorl custom database datagridview datastructure datetime dbconnection development directrobot disabled dll drawing dubai e-commerce ecommerce enum eventhandlers file form forms game gdi+ httpwebrequest index javascript keypress label lisp list listbox listview mdd messagebox msword mysql operator packaging panel password path photoshop php post problem programmer programming read redirect region remote remoting reporting resource richtextbox robot smoobjects softwaredevelopment sql sql-server sqlserver statistics stream string study table tables textbox totaldays usercontrol vb visual visualbasic visualstudio webbrowser webdevelopment windows winforms working wpf write







