Im working on a program to get single characters from a string and i guess im doing it wrong but i was using strok() to tokenize the string in the hopes that it would do so but anyway this is what ive got so far
and before you ask its not for a college class i mean for goodness sakes im not even out of high yet.
now i know that im not using a delimiter so i understand if you post something about strok() but i guess what im asking is how would i go about obtaining a single char from a string or should i just use a char array? then call it by name ie ar[1]
the end goal however is to take all the characters in a string and see what words you can make out of it(compared against data in a file).
//for example
FILE:
rabbit ball
at all new found etc.
input:cat
at found
#include <iostream>
#include <string>
using namespace std;
int main(){
char input[30];
char * sc;
cout<<"Name:";
cin>>input;
pch= strtok(input, "");
while(sc != NULL){
cout<<sc<<endl;
pch=strtok(NULL,"");
}
}