到目前为止我有以下程序:
using System;
namespace ParkingTicket
{
class Program
{
static void Main()
{
int speed;
int yrInSchool;
double fine;
char choice = ' ';
do
{
Console.Clear();
speed = GetSpeed();
if (speed <= 15)
Console.WriteLine("No speeding fine to pay.");
else
{
yrInSchool = GetYrInSchool();
fine = CalculateFine(speed, yrInSchool);
DisplayFine(fine);
}
choice = GetUserChoice();
} while (choice != 'Q' && choice != 'q');
}
static int GetSpeed()
{
int speed;
string userInput;
try
{
Console.Write("Please enter the speed you were traveling: …Run Code Online (Sandbox Code Playgroud) 由于if声明中的第一行,我无法运行它.我确信有些东西需要转换,但我不确定是什么.
using System;
using System.Collections.Generic;
using System.Text;
namespace xx
{
class Program
{
static void Main(string[] args)
{
string userInput;
Console.Write("what number do you choose: ");
userInput = Console.ReadLine();
if (userInput > 100)
Console.WriteLine("I hate myself");
else
Console.WriteLine("I love myself");
}
}
}
Run Code Online (Sandbox Code Playgroud)