Mega Code Archive

 
Categories / C++ / String
 

Get the string length

#include <iostream>   #include <string.h>   using namespace std; main(void)   {     int i;     i = 10;           int j = 100;         cout << i*j << "\n";           cout << "Enter a string: ";     char str[80];     cin >> str;           // display the string in reverse order     int k;     k = strlen(str);     k--;     while(k>=0) {       cout << str[k];       k--;     }           return 0;   }