i am building a small app that act like a digital camera, and on my takephoto function i want to insert a random number to my array(i succeed doing that), my problem is that when i take multiple pictures the value always go into the first postion. my code:
public override void TakePhoto()
{
Random rnd = new Random();
int photo = rnd.Next(1, 10);
for (int i = 0; i < 1; i++)
{
MemoryCard.buffer[i] = photo;
}
}
class Program
{
static void Main(string[] args)
{
DigitalCamera digitalCamera =
new DigitalCamera("kodak", 43, newMemoryCard, 3);
digitalCamera.TakePhoto();
digitalCamera.TakePhoto();
digitalCamera.TakePhoto();
}
}
how do i jump to the next position after each photo?
I think following modification to your code will resolve your issue: