Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- string s; char c;
- cout << "Nhap s: "; getline(cin, s);
- cout << "Nhap c: "; cin >> c;
- int pos = -1;
- for (int i = 0; i < s.size(); i++) {
- if (s[i] == c && pos == -1) pos = i;
- }
- cout << "Vi tri dau tien chua ky tu c: " << pos << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment