Hey! so i recently took a YouTube playlist of learning how to program and I got this "homework" from the creator to make a code that based on what he said to do! and so i did that and i know the wrong line is on "while(roll1 = roll2)" and the result supposed to look like the photo on the attachment! hope you can help me!
here is the code:
using System;
namespace VS_code
{
internal class NewBaseType
{
static void Main(string[] args)
{
Random numberGen = new Random();
int roll1 = 0;
int roll2 = 0;
int attemps = 0;
Console.WriteLine("press enter to roll dice.");
while(roll1 = roll2) {
Console.ReadKey();
roll2 = numberGen.Next (1, 7);
roll1 = numberGen.Next (1, 7);
Console.WriteLine(" roll 1: " + roll1);
Console.WriteLine(" roll 2: " + roll2);
attemps++;
}
Console.WriteLine("it took you " + attemps + " attemps to roll two of a kind");
Console.ReadKey();
}
}
}
here is the code:
using System;
namespace VS_code
{
internal class NewBaseType
{
static void Main(string[] args)
{
Random numberGen = new Random();
int roll1 = 0;
int roll2 = 0;
int attemps = 0;
Console.WriteLine("press enter to roll dice.");
while(roll1 = roll2) {
Console.ReadKey();
roll2 = numberGen.Next (1, 7);
roll1 = numberGen.Next (1, 7);
Console.WriteLine(" roll 1: " + roll1);
Console.WriteLine(" roll 2: " + roll2);
attemps++;
}
Console.WriteLine("it took you " + attemps + " attemps to roll two of a kind");
Console.ReadKey();
}
}
}