jeudi 20 décembre 2018

how to determine / set the length of a string from user input (std::cin)

Please help me, I've try this case but I got stuck in a trouble. I just wanna to determine length of a string form user input or from console. But it doesn't work. I'm sorry my english is bad. I hope there's someone who can help me. Thank you.

#include <iostream>
#include <string>

using namespace std;

int main(){
int N;
char S;
char vokal;
vokal = {'a'||'i'||'u'||'e'||'o'};

cout << "Length of Spaghetti Name: ";
cin >> N;
fflush(stdin);

cout << "Spaghetti Name: ";
cin >> S;


cout << S << endl;
cin.get();
return 0;
}

Aucun commentaire:

Enregistrer un commentaire