• с++ как задать массив случайным образом
    int a[16]

Ответы 1

  • #include <iostream.h>//для vs <iostream>#include <conio.h>/* для vs :using std::cin;using std::cout;using std::endl;using std::srand;using std::rand;*/int main(){  int a[16],i,n;randomize();//<->srand; cout<<"EXIT-0";while(n!=0 ){M: cout<<"Vvedite Razmer Massiva (N<=16) :";cin>>n;if(n>16) cout<<"Error! N>16 . Try again";if(n>16) goto M;for (i=0;i<n;i++)a[i]=random(100);//<->rand();cout<<endl;for (i=0;i<n;i++)cout<<a[i]<<" ";cout<<endl;}getch(); return 0;}
  • Добавить свой ответ

Еще вопросы

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years