Hey, I'm not sure how to do this. I know how to convert a char into an int, getting the ascii value, or the numeric value, but that's not what I want to do.

Basically I have a CHAR, I give it a value, usually a short sentence, then I display it on screen, but I have a boarder thats dependent on the length of that sentence, so if I could get an interger representing the length (how many characters), that would help me A LOT.

How can I get it to convert for example like, the CHAR is "Hello There" after converting to an INT it should output 11, as there are 11 characters including the space...

Hopefully you guys understand, anyone able to help me out?

Thanks so much!

It almost sounds like you are trying to calculate the length of a string like strlen does.

Ugh, one of my half retarded days. lol

Thanks.

Ugh, one of my half retarded days. lol

Thanks.

We all have those kind of days on occasion. :)

/* Wap to input a string and calculate its length  */
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
void main()
{
clrscr();
int len=0,i;
char str[50];
cout<<"**** Atishay c++ programming LTD. ****" <<endl<<endl;
cout<<"Input a string (word)"<<endl;
gets(str);
for(i=0;str[i]!='\0';i++)
{
len++;
}
cout<<"Your entered string has length of  "<<len<<endl;
getch();
}
for(i=0;str[i]!='\0';i++)
{
len++;
}

you could optimize that loop like this:

for(len = 0; str[len] != 0; len++)
   ;

ooooooh gud idea....thax.