wow im glad i joined this forum haha. ok so my newest problem is with arrays.
#1. somehow the array im getting is -8,5,8,9,9,3,4,6,0 instead of 0-6. i dont even know how its getting 9 slots.
#2. i dont know how to make it so you can pick 1 slot that you want to view. i gave it my best shot but the way I have it my program crashed when you try to choose a slot.
thank you. heres my code:
Code:
#include <iostream>
using namespace std;
int main ()
{
int a;
int b;
int x;
int array [7];
int *z;
z = array;
cout<< "press 1 to see the whole array, press 2 to pick 1 slot.\n";
cin>> a;
switch (a) {
case 1:
cout<< "this be yo' array dawg:\n";
for (x = 0; x < 7; x++) {
cout<< array [x];
break;
case 2:
cout<< "which slot would you like to view? 0-6\n";
cin>> b;
cout<< array [*z];
break;
default:
cout<< "NO\n";
break;
}
}
cin.get();
}