It compiles perfectly but how can I use rand to only go thru 0-15?Code:#include <iostream> int main() { int Age; int IDontFkingKnow; int array[16][16]; std::cout<<"Please enter age: "; std::cin>>Age; while (Age<16, Age++) { IDontFkingKnow=rand(); array[Age][IDontFkingKnow]=Age * IDontFkingKnow; } std::cout<<Age<<"*"<<IDontFkingKnow<<"="<<array[Age][IDontFkingKnow]<<" "; std::cout<<"\n"; std::cin.get(); return 0; }



LinkBack URL
About LinkBacks



I dont know i dont know how to declare arrays so that seemed logical :'(
I also recommend you to read a tutorial about arrays. When you create an array, you specify how many 'boxes' it should contain. You specify that it should have 3 boxes, but later you try to access the fourth box which will give you a crash.