C++ alapok - 9. rész Véletlenek C++-ban

 Generáljunk véletlenszámokat c++ nyelven. Nem csak egészeket!!!!



Forráskód:


#include <iostream>


/* run this program using the console pauser or add your own getch, system("pause") or input loop */

using namespace std;

int main(int argc, char** argv) {

//int veletlen=rand()%100;

//int veletlen=rand()%50+10;

for(int i=0;i<15;i++){

double veletlen=rand()%10+10;

cout<<veletlen/10<<endl;

}

return 0;

}


Videó: