79571612

Date: 2025-04-13 13:49:40
Score: 1
Natty:
Report link

While I can help you with the code solution, you might also be interested in checking out a ready-to-use random animal generator at https://randomgenerator.pro/random-animal-generator if you need quick inspiration or testing data.

For the coding solution, here's how you can implement the random animal classification system:

#include <iostream>

#include <cstdlib>

#include <ctime>

using namespace std;

int getRandomAnswer() {

return rand() % 2; // Returns 0 or 1 randomly

}

int main() {

// Seed the random number generator

srand(time(0));

cout << "Random Animal Generator\n\n";

// First question

cout << "Is the animal a vertebrate? ";

int answer = getRandomAnswer();

cout << (answer ? "Yes" : "No") << " - ";

if (!answer) {

cout << "The animal is an Insect!\n";

} else {

// Second question (only if vertebrate)

cout << "Not Insect\nIs the animal warm-blooded? ";

answer = getRandomAnswer();

cout << (answer ? "Yes" : "No") << " - ";

if (!answer) {

cout << "The animal is a Reptile!\n";

} else {

// Third question (only if warm-blooded)

cout << "Not Reptile\nCan the animal fly? ";

answer = getRandomAnswer();

cout << (answer ? "Yes" : "No") << " - ";

if (answer) {

cout << "The animal is a Bird!\n";

} else {

cout << "The animal is a Mammal!\n";

}

}

}

return 0;

}

The code above implements a basic random animal classifier. However, if you need a more comprehensive solution with actual animal data and characteristics, the online generator I mentioned above might be helpful alongside your code implementation.

Let me know if you need any clarification on the code!

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: indian cricket