I am attempting to write a program that will use a post conditional loop. The loop is calculating Celsius to Fahrenheit conversions. I have the equation down but i cannot get the output that way i need it to be. I need to output both temperatures to the same label while keeping the C and F temps in their own organized column. here is a link showing exactly what i am attempting to do:
After that, i need to right justify the table while keeping the C temp data in the same place. I am not sure how to do either of these and apparently after 2 and a half hours of searching on google, it seems google doesnt know either. I am a beginner in C# and i cannot find anything that says how to do this specifically so i can learn to do it myself. Any help will greatly be appreciated. Happy holidays!!!
This is my current code i have, Im still working on it but the data keeps getting bunched together, and i need only to have the words Fahrenheit and Celceius displayed only once at the top
double Celceius=0;
double Fahrenheit;
lblOUT.BackColor=Color.Red;
while (Celceius <= 100)
{
Fahrenheit = 32 + (Celceius * 1.8);
lblOUT.Text += "Celceius"+ "Fahrenheit"+Convert.ToString(Celceius) + Environment.NewLine + Convert.ToString(Fahrenheit);
Celceius += 5;
}
You can use String.PadLeft function to pad spaces before your Fahrenheit values. You can give maximum length, 3 in your case, to pad necessary spaces. It will only pad spaces if length is smaller. You can check the details on below MSDN link.
http://msdn.microsoft.com/en-us/library/system.string.padleft%28v=vs.110%29.aspx
Below code will generate the list, but remember to use font which has equal size for each character such as "Courier New"