C++ lottery simulator help

Hello, I’ve had a project idea to make a lottery simulator using a random number generator but it wont work.

#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <stdlib.h>
int main() {
    std::string a, b, c, d, e, f;
    std::cout << "Welcome to the lotto simulator" <<   std::endl <<  std::endl <<   std::endl;
    std::cout << "To begen, type 6 numbers between 1-49: ";
    std::cin >> a >> b >> c >> d >> e >> f;
    system("clear");
    srand(time(0));
    if(a == 1+(rand()%49) && b == 1+(rand()%49) && c == 1+(rand()%49) && d ==  1+(rand()%49) && e ==  1+(rand()%49) && f == 1+(rand()%49)) {
       std::cout << "You won!!      " << "6/6"  <<   std::endl <<   std::endl <<  std::endl;
       std::cout << "Same chances of winning the acual lottery";
    }
     if(a == 1+(rand()%49) && b == 1+(rand()%49) && c == 1+(rand()%49) && d ==  1+(rand()%49) && e ==  1+(rand()%49)) {
        std::cout << "You won!!      " << "5/6"  <<   std::endl <<   std::endl <<   std::endl;
        std::cout << "Same chances of winning the acual lottery";
    }
    if(a == 1+(rand()%49) && b == 1+(rand()%49) && c == 1+(rand()%49) && d ==  1+(rand()%49)) {
      std:: cout << "You won!!      " << "4/6"  <<  std::endl <<  std::endl <<   std::endl;
      std::cout << "Same chances of winning the acual lottery";
    }
    if(a == 1+(rand()%49) && b == 1+(rand()%49) && c == 1+(rand()%49)) {
          std::cout << "You won!!      " << "3/6";
    }
    if(a == 1+(rand()%49) && b == 1+(rand()%49) && c == 1+(rand()%49)) {
          std::cout << "You won!!      " << "2/6";
    }
     if(a == 1+(rand()%49) && b == 1+(rand()%49)) {
          std::cout << "You won!!      " << "1/6";
    }
return 0;
}

Ok, I’ll check it out.

First thing, though, maybe enter the number separately (like ask for number 1, then number 2, then number 3).

Also, you should pick the random numbers before the if statements. And you have to ensure the random numbers are unique (not the same as the other randoms).

Might be a good time to figure out arrays :slight_smile: