+ 1
Array
How I can do array or program that ask the user to inter his name if his name is correct as array that i pointed on . will print to user a message ? https://www.sololearn.com/discuss/1285604/?ref=app
4 Antworten
0
I can write you a pseudo code since you didn't specify any language.
# INITIALIZE YOUR ARRAY WITH NAMES YOU LIKE
# ASK USER FOR INPUT
# STORE THE INPUT AS STRING IN A VARIABLE
# MAKE A FOR LOOP THAT LOOPS THROUGH THE ARRAY
#MAKE A CONDITION check if the index is = to the name. Like if(array_index[x] == "stored_name")
#THEN PRINT OUT A CUSTOM OUTPUT
if you are using multiple names then switch would be better choice.
0
Thanks bro
0
Is going to be like that ? However THERE is an errors🐰
0
#include <iostream>
using namespace std;
int main() {
cout<<"i aupose youvarev my clasmate \n";
int g;
cin>>g;
string s[]={mkdad};
s=g;
for(int d=0,d==s,d++)
if (g==s){
cout<<"you are welcome\n";
}
return 0;
}