#include #include using namespace std; void main() { string a = ""; string find = ""; string fpointer = ""; string ftopper = ""; int fpos = 0; int flength = 0; cout << "Input a:\n"; cin >> a; cout << "Find what in a?\n"; cin >> find; fpos = a.find(find); flength = find.length(); for(int i = 0; i < fpos+3; i++) //The +3 makes up for the space taken by "a: " { fpointer += " "; ftopper += " "; } for(int i = 0; i < flength; i++) { fpointer += "^"; ftopper += "_"; } if(fpos > -1) { cout << ftopper << endl; } cout << "a: " << a << endl; if(fpos > -1) { cout << fpointer << endl; } cout << "Found pos: " << fpos /*(fpos > -1 ? fpos : "NOT FOUND.")*/ << endl; }