Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to use some type of string command

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How can I input a number into a string...
ex: input 14a and i want the "string" to be {1,4,a}
And then would I use length("string") to find the length
of it?
 
Hi

#include <iostream.h>
#include <string.h>


main (void) {

// input buffer
char yourinput[128] = {'\0'};
// get kbd input max 80 chars or &quot;enter&quot; key
cin.get(yourinput,80,'\n');
// display user input
cout << yourinput << endl;
// show how many char (includes numbers etc)
cout << '\n' << strlen(yourinput) << endl;

}
[sig]<p>Robert Dwyer<br><a href=mailto:rdwyer@orion-online.com.au>rdwyer@orion-online.com.au</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top