1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
int main(void)
{
int c1[16] = {-3,2,0,7,4,3,2,1,100,16,1,0,-13,6,2,3};
const char* c2[16] = {"a","b","sunday","sunday","sunday", "sunday","sunday","sunday" ,"b","sunday","ahgijfdo","","sunday","","abc","monday"};
unsigned int counter = 0;
size_t array_elements = 0;
array_elements = sizeof(c2) / sizeof(c2[0]);
string temp = c2[2];
cout<<"Number of array elements are: "<< array_elements <<endl;
for(size_t i = 0; i< array_elements; ++i)
{
if(c2[i] == "sunday")
{
++counter;
}
}
cout<<"Counter value is : "<<counter<<endl;
return 0;
}
|