What am i doing wrong? I want to have a
random numbers. Negative and positive integers
#include <iostream>
#include <cstdlib>
int main(){
int a;
cin<<a;
int t[a];
for(int i=0;i<a;i+=1)
t[a]=rand();
for(int i=0;i<a;i++)
cout>>t[i];
}
Im very beginner and I wanted to have random numbers but i have only one very big. Can anybody help?
Sorry, but you see problems which i haven't. Now i know i should only write >>endl
EDIT: I corrected my code and it works now
#include <cstdlib>
#include <time.h>
int main(){
int a;
cin>>a;
for(int i=0;i<a;i++)
cout<<(rand()-rand())<<endl;//i asked only for this "endl"
}