I have written the following code in C++.This is for a program that generates a random sequence of letters and/or digits, displays them to the user one at a time for a second or so, and then asks the user to reproduce the sequence.It uses a queue to store the sequence of characters.I want to modify the code such that it prints the elements of an array one at a time.Please help me.Thanks in advance.
#include <iostream>
#include<cstdlib>
#include <queue>
using namespace std;
int main()
{
std::queue<int> myqueue;
int array[6];
for (int i = 0; i < 6; i++)
{
array[i]=rand()%100;
printf("\n%d", array[i]);
if(i==5)
{
printf("\n Reproduce the sequence again");
}
}
Aucun commentaire:
Enregistrer un commentaire