Answered Help with console app

Anton

New member
Joined
Oct 4, 2020
Messages
2
Programming Experience
Beginner
hi guys i am new to c# i am trying to make a console app for an online game
it needs to calculate the version that the user inputs and output it to the screen
the formula is 10000 = 22345
for example the version 1.04Q = 1.04.17
C#:
using System;
using System.Collections.Generic;
using System.Text;

namespace _UcD_Version_Calculator
{
    class Program
    {
        static void Main(string[] args)
        {
            const int first  = 10000;
            const int second = 22345;
            Console.Title = "[UcD]Version Calculator 0.1";
            String Description = String.Format("//====================================================\n//  [UcD]Version Calculator 0.1\n//  Developed By UcD CrashOverride \n//  Date: 04/10/2020\n//==================================================== ");
            Console.WriteLine(Description);
            Console.WriteLine("Program Started:\n");
            Console.WriteLine("Please Input ServerFiles Version For Example (1.02.13):");
          
            int input = Convert.ToInt32(Console.ReadLine());

    
            input -= first     ;
            input += second    ;
            Console.WriteLine("Your Client Version Is:\n" + input);
            Console.ReadLine();
        }
    }
}
this is whats been done for now how can i add . to the input because for now the input is 10213 and i want it to be 1.02.13
one more question how to convert from 1.04Q to 1.04.17 ???
 
I think you need to explain a bit further what 'Q' in the input string represents, and why the 'Q' get replaced with a ".17".
 
It would have helped us a lot if you hand linked to the following...
 
Q is the 17th letter in the alphabet. Although this hunch might be right. It's a weird way to create version numbers... It's also incorrect. Why would the user be providing a version number, and not the app?

And why are there letters in your versions?

Further explanation needed...

The way you're going will need string building.

Mobile reply
 
It would have helped us a lot if you hand linked to the following...
it has nothing to do with this because i only took the formula out of there basically the default version of the file is 1.00.00 = 10000 this and the 22345 are by default
 
It would have helped it you took time to explain your conversion rules.

So is are these valid versions?
88764
1BS
10000Q
3Dr
 
I know I have seen some programs post letters in their versions, but I fail to see the point of doing it. And for those that do it, normally do-so to brand their version as alpha or development version etc ie v 1.2.d

I'm more confused why a program would be asking the user for the version number, as I would have thought this would be the job of the developer to implement...

int input = Convert.ToInt32(Console.ReadLine());
You really would be best trying to first try parse the user input instead of converting it blindly with the misguided hope that your users will enter in a value that can actually be converted by the convert call to your type.

Since version 4.0, we can use Version.Parse Method (System)

I think you should explain what it is you are trying to do first, and in more detail than the above.
 
Back
Top Bottom