Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

hello_12345

  • 3 years ago

In c++, How do you make a function to ask the user input, and then store that input? It would ask 3 different chars, and store them?

  • This Question is Closed
  1. Shadowys
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    use an array for the storage, and a for/while loop to ask the user repeatedly three times to input something into the array. do you need further help?

  2. hello_12345
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @Shadowys Can you post an example? The way I have it set up is not working

  3. Hunus
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    #include <stdio.h> #include <stdlib.h> int main() { char entry[3], i, k; for(i=0; i<3; ++i){ int c = getchar(); int t = c; if ( c == '\n' ) { i -= 1; continue; }else{ entry[i] = t; } } for(k=0; k<3; ++k){ printf("%c ", entry[k], "\n"); } system("PAUSE"); } Something like this? (This is in C)

  4. Hunus
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Something that takes 3 character inputs and saves them?

  5. hello_12345
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @hunus yes,

  6. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy