Hi guys. I'm working on a program that reverses the string the user inputs and displays it. The other requirement is for it to search if the word "junk" is in the original input or not. I'm having issues in searching for the word junk. Here's my code so far:
#include <stdio.h>
#include <iostream>
#include <cstring>
using namespace std;
int main(void)
{
const int SIZE = 100;
char c[SIZE];
cout << "Enter a line of text below: " ;
reverse();
putchar('\n');
char *strPtr = NULL;
int index;
for (index = 0; index <c ; index++)
{
if (strPtr != NULL)
break;
}
if (strPtr != NULL)
cout << c[index] << endl;
else
cout << "The word junk was not in the original text. \n" ;