Can You Shift an Array by a User-Inputted Value Using For Loops?

  • Thread starter Thread starter AST3019
  • Start date Start date
  • Tags Tags
    Array Indices
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 3K views
AST3019
Messages
4
Reaction score
0
So I am trying to use for loops to shift the index an array by a user inputted value. The code i have so far is
printMessage();
cin >> choice;
if(choice == 2){
count << endl;
count <<"Please enter the desired number of shifts:" << endl;
cin >> b;
int s;
for (s = 0; s == b;s++) {
count << message[s + b];
}

}
When I try to compile it, it doesn' count the message. The input from the message occurs earlier in the code.
 
Physics news on Phys.org
yeah, right after i posted the thread i realized that and fixed it and now it works. thanks though.