iam arabian man![]()
alekm alslam![]()
Ok this gives an example of "parsing" text in the way that you want to....
Hope this helps.......Code:/* Parsing Function */ #include <windows.h> #include <iostream> using namespace std; void Parse_It(char* the_text); int main() { char text_line[300]; while (1) { cout << "Enter a line of text to be parsed: "; cin.getline(text_line, 299, '\n'); Parse_It(text_line); } } void Parse_It(char* the_text) { int i; int len_str = strlen(the_text); for (i = 0; i < len_str; i++) { if ((the_text[i] != 'a') && (the_text[i] != 'b')) { cout << "Invalid character(s) in the phrase\n"; return; } } cout << "All character(s) are valid!\n"; }
Last edited by MeTh0Dz; 05-29-2008 at 02:52 PM.
you right it in c++ but i want it in c
second i want the user he input what he want from language
you can see what i put in the first in this subject in c langage and try to fixed it
iam trying to understand it but i like it in c and have many function
Dude what do you think I am your personal coder? C and C++ syntax does not differ much especially in simple stuff like this, just substitute out the C++ only stuff. You should be able to look at my code and figure out what you need to change in order to get it to do what you need. Otherwise you are nothing but a scriptkiddie, and scriptkiddies are teh sux.
ok thankyou for helping me
Yeah just experiment with that code and eventually you'll get what you need. The only functionality you really need to add is what characters to check for, which won't be difficult at all if you see how I am already doing it with "a" and "b". It already prompts the user for the string to parse..
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks