Tak na szybko w C++ i w Javie.
C++
#include
#include
#include
#include
#include
#include
using namespace std;
string random [] = {"Counter Strike: Global Offensive", "CrimeCraft: GangWars", "Ghost Recon: Online", "WarFrame", "LeaugeOfLegends", "Ace Of Spades", "WarZ", "Left 4 Dead 2", "Saints Row IV", "Magicka", "TES: Skyrim"};
int number;
int main ()
{
srand(time(0));
int rand_index = rand() % 10;
cout << "Gra na dzis to: ";
cout << random[rand_index];
getch();
return 0;
}
RpsBW.java:
public class RpsBW
{
public static void main(String[] args)
{
String[] objects = {"Counter Strike: Global Offensive", "CrimeCraft:GangWars", "Ghost Recon: Online", "WarFrame", "LeaugeOfLegends", "Ace Of Spades", "WarZ", "Left 4 Dead 2", "Saints Row IV", "Magicka", "TES: Skyrim"};
int length = objects.length;
int rand = (int) (Math.random() * length);
System.out.println("Twoja gra na dziś, to: ");
System.out.println(objects[rand]);
}
}
Jeśli chcesz mieć np. exe to wklej sobie kod c++ tutaj: http://www.onlinecompiler.net/
Kliknij na COMPILE (przy zaznaczonym windowsie) i pobierz po kompilacji plik .exe
Mi działa ten: http://www.onlinecompiler.net/upload/tmp/9v5X5RFs.exe
Wszystko powinno śmigać.
//spieprzyły się wcięcia w kodzie, ale to nie jest ważne.