0

Wrong answer

This is my code #include <iostream> #include <string> using namespace std; int main(){ string name; int harfB [50]; int harfK [50]; for (int i = 0 ; name != "\n" ; i++){ cin >> name; harfK [i] = name [0]; for (int j = 0 ; name [j] != '\0' ; j++) if (name [j] >= 65 && name [j] <= 90) harfB [i] = name [j]; cout << harfB [i] << endl << harfK [i] << endl; } system ("pause"); } I give it "zohalGhasemzadeh" but the answers are either unexpected or wrong I want it to take capital G and put it in harfB Then take the first letter (z) and put it in harfK Both as integers Can anybody tell me why doesnt it work?

9th Dec 2019, 6:02 PM
Zohal
Zohal - avatar
1 Antwort