Загрузка...

I ask for a helping hand, I need to rewrite the code from C ++ to C

Thread in C/C++ created by Reltar Oct 10, 2022. 141 view

  1. Reltar
    Reltar Topic starter Oct 10, 2022 8 Apr 20, 2019
    C
    #include <iostream>
    #include <algorithm>
    #include <string>
    using namespace std;
    void main() {
    char L[] = ",";
    int k = 0;
    setlocale(LC_ALL, "ru");
    string S{};
    getline(cin, S);
    for (int i = 0; i < S.size(); i++) {
    if (S[i] == L[0]) {
    k++;
    }
    }
    replace(S.begin(), S.end(), ',', '!');
    cout << S<<endl;
    cout << k;
    }
     
Top
Loading...