Saturday, 1 January 2022

how to loop a string array in c++?

#include "iostream"

#include "string.h"


using namespace std;


int main()

{

    string strNames[] = { "Name1", "Name2", "Name3", "Name4", "Name5", "Name6"};


    for each(string name in strNames)

    {

       printf("%s\n", name.c_str());

    }

    return 0;

}

No comments:

Post a Comment