2
Answers

How can I store user's input into 10x4 array until EXIT button is cliked?

Akash

Akash

19y
2.4k
1
I am doing a fairly small project to calculate future value base on monthly amount invested and percent rate and how long.  I want to hold 10 calculatioin in an array with 4 columns to hold 1.monlthyInvestment, 2.interestRate, 3.years, 4.futureValue and display all these in a MessageBox.  can anyone help me please?
Answers (2)
1
Vulpes
NA 98.3k 1.5m 13y
{0:F2} means format what's in the first placeholder to 2 decimal places. So, if 'C' were 100, then it would format it as '100.00'.

{0} {1} means print what's in the first placeholder, followed by a space, followed by what's in the second placeholder. As you're only printing one number here, this would not be applicable.

Accepted
0
Senthilkumar
NA 15.2k 2.4m 13y
Hi,

Vulpes explained in the nice way.

Like this while(true)
       {

        }

you can use the following statement to infinite loop

for(;;)
{

}


0
Suthish Nair
NA 31.7k 4.6m 13y
Aditya, It seems you are not accepting the thread as Answer that helped you to resolve your problem. Its not a good practice, here we all are spending our time to help you. So Mark the thread as Answer, if it got resolved, so others can also get help from it.
0
Suthish Nair
NA 31.7k 4.6m 13y
Vulpes, nice explanation..
0
Aditya Varma Mudunuri
NA 58 83.3k 13y
What is the meaning of this block {0:F2} in the above code because Generally we use {0} {1} like this to print the values in WriteLine Method

Why not the General one's cannot be worked out here in this example
0
Vulpes
NA 98.3k 1.5m 13y
Just change the Main() method to the following:

       static void Main(string[] args)
       {
          while(true) // loops indefinitely
          {
             Console.WriteLine("Select the Conversion Direction");
             Console.WriteLine("1.Celsius to FahrenHeit");
             Console.WriteLine("2.FahrenHeit to Celsius");
             Console.WriteLine("3.Exit application"); // need an exit route now
             Console.Write("You selected :");

             double F, C = 0;
             string selection = Console.ReadLine();
             Console.WriteLine();        
        
             switch (selection)
             {
                case "1":
                   Console.WriteLine("PLease Enter Celsius Temperature");
                   F = TempConverter.CelsiusToFahrenheit(Console.ReadLine());
                   Console.WriteLine("Temperature in FahrenHeit is {0:F2}",F); break;

                case "2":
                   Console.WriteLine("PLease Enter FahrenHiet Temperature");
                   C = TempConverter.FahrenheitToCelsius(Console.ReadLine());
                   Console.WriteLine("Temperature in Celsius is {0:F2}",C); break;
               
                case "3":
                   return; // returns from Main method and so exits application
 
                default:
                   Console.WriteLine("Please Select the Convertor");break;                   
             }

             Console.WriteLine();
          }
       }
0
Aditya Varma Mudunuri
NA 58 83.3k 13y
Now what my problem is after entering the celsius temperature the console quits the application whereas what i want is if any conversion or Viceversa is done even after it should return back to the console to take another conversion in the same console without rebuidling the application

Please Find me a solution.........................
0
Vulpes
NA 98.3k 1.5m 13y
You appear to have uploaded the wrong file.

The file you've uploaded is called EmpTax.cs, not TempConverter.cs.