Tuesday, April 24, 2012

C++ program to return input string length

the code receive line from user and print out his line characters count
# include <iostream>
# include <string>
# include <stdio.h>
using namespace std;

string print_upper(string *);

main ()
{
string i;
print_upper(&i);
system ("pause");
}

string print_upper(string *parag)
{ int len=0;
cout << "Please enter full name: ";
getline (cin,*parag);
len= strlen(char *parag); //(الخلل هو: رفض عرض الطول مع نص يستقبله البرنامج من المستخدم)
//for (int c=1; c<= int strlen(*parag); c++)
//cout << len;
cout << "The text with Uppercase: " << *parag << endl;
}


No comments:

Post a Comment