Re: -= Having Difficulties in C++? Be a Part of This Thread =-
Use the "strtok" function.
http://www.cplusplus.com/reference/cstring/strtok/
Mga master papano po kaya icode to?
Enter your name(LastName, FirstName, MI): dela Cruz, Juan P.
Your name is Juan P. dela Cruz
ginamitan po namin ng string manipulation functions yan. ang di ko lang po magets ay kung papaano maalis yung ','
kumbaga ganito ang lumalabas
Your name is Juan P. dela Cruz,
ito po bali yung code ko.
Code:#include<iostream.h> #include<conio.h> #include<string.h> #include<stdio.h> main() { char name[20], x[20], y[20]; clrscr(); cout<<"\nEnter your name (LastName, FirstName, MI):"; gets(name); strcpy(x, strchr(name, ' ')); strcpy(y, strrev(strchr(strrev(name), ','))); cout<<"\nYour name is" << x << y; getch(); return 0; }
thank you po sa makakatulong
Use the "strtok" function.
http://www.cplusplus.com/reference/cstring/strtok/