Pages

Tuesday, April 22, 2025

Char Array (for each loop) in C++

#include <iostream>

#include <cstring>

using namespace std;



int main()

{

    string str = "apna college";

    

    

    // for(int i=0; i<str.length(); i++) {

    //     cout << str[i] << "-";

        

    // } cout << "\n";

        

        for(char ch : str) {

            cout << ch << ",";

        } cout << endl;

    

    // for(char ch : str) {

    //     cout << ch << ",";

    // }

    // cout << endl;


    return 0;

}

No comments:

Post a Comment

how to become red on codeforces by Errichto Algorithms | explained simply in a blog

 Yes. I found an available transcript of the video and summarized it simply. The video is “How To Become Red Coder? (codeforces.com)” by Err...