i want to ask a user to input 2 values. after that i would like to assign the two values to an array: "Two Numbers"
but i keep getting this error:invalid types 'double[int]' for array subscript.
1 2 3 4 5 6 7
int main(){
double x,y;
cout<<"Enter two numbers "<<endl;
cin>>x >>y;
double TwoNumbers[2];
TwoNumbers={x,y};
im trying to ask the user to input 2 values. then after that my script would call function "arrangeTwoNumbers" to arrange the 2 value in increasing order.
If you don't put curly braces around the code after an else, then only the first line is considered to part of the block.
So, as you can see, the TwoNumbers variable is defined in a scope that immediately ends.
EDIT: You don't seem to understand variable scope at all. You've defined several variables called TwoNumbers - at line 11, line 20, and line 24. These are all different entities, with different scopes and different lifetimes. Assigning a value to one of them will not change the value of the others.
I'd recommend going back to your textbook/tutorial material and getting a better understanding of scope.