Write a function Noodles with int parameter minutes and void
Write a function Noodles(), with int parameter minutes, and void return type. Print \"N minutes\" for each minute in decreasing order, where N is the number of minutes, followed by \"Done\".End with a newline. The number of minutes is generated from a random number generator that selects between 1-3 minutes. The seed for the random number generator is input by the user.
Example output for minutes = 2:
Solution
#include <iostream>
#include <cstdlib>
using namespace std;
void Noodles(int);
int main() {
int minutes = 0;
int seed;
cout<<\"enter random seed\"<<\"\ \";
cin >> seed; // reading seed
srand(seed);
minutes=rand()%3; // random number generation
cout<<minutes<<\"\ \";
Noodles(minutes);
return 0;
}
// Noodles function definition
void Noodles(int N)
{
while(N!=0)
{
cout<<N<<\" minutes\ \";
N--; // N value decrement by one minute.
}
cout<<\"done\ \";
}
output:
enter random seed
100
2
2 minutes
1 minutes
done
