A community for students.
Here's the question you clicked on:
 0 viewing
hello_12345
 2 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?
hello_12345
 2 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

Shadowys
 2 years ago
Best ResponseYou've already chosen the best response.1use 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?

hello_12345
 2 years ago
Best ResponseYou've already chosen the best response.0@Shadowys Can you post an example? The way I have it set up is not working

Hunus
 2 years ago
Best ResponseYou've already chosen the best response.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)

Hunus
 2 years ago
Best ResponseYou've already chosen the best response.0Something that takes 3 character inputs and saves them?
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.