Currently working on an exercise to create a shopping app, currently working on the check out method of the program where the user selects their payment type through a simple console based program that uses numerical selections. Getting error CS0029 "cannot implicitly convert type int to string"
In the context of the code "input" Is the console.readline(); that the user inputs when asked for their selection.
public void UserInformation()
{
string input = "";
Console.WriteLine("Please enter your Name");
string userName = Console.ReadLine();
Console.WriteLine("Please enter your address");
Console.Write(">");
string userAddress = Console.ReadLine();
Console.WriteLine("Please Select payment type");
Console.WriteLine("1. Debit");
Console.WriteLine("2. Credit");
Console.WriteLine("3. Cash on delivery");
input = Console.ReadLine();
Console.Write(">");
if (input = 1)// gives error CS0029 "cannot implicitly convert
type int to string"
{
//Debit
Console.WriteLine($"Your total is {total}");
Console.WriteLine("Please enter your Debit card Number");
string userDebit = Console.ReadLine();
Console.Write(">");
}
else
if (input = 2)
{
//Credit
Console.WriteLine($"Your total is {total}");
Console.WriteLine("Please select card type");
Console.WriteLine("1. Visa");
Console.WriteLine("2. Mastercard");
Console.WriteLine("3. American Express");
string userCredit = Console.ReadLine();
Console.Write(">");
}