Hi, how do I tell the if statement to output this error message 'exceeded the maximum amount of characters' that has its characters stored in an array using c-style string?
[INPUT] The cat caught the mouse!
[OUTPUT] Exceeded the maximum amount of characters (max 10)
#include<iostream>
#include<string>
#include <cstring>
usingnamespace std;
int main()
{
string text, save, final_output, reverse_word;
int word_count(0), pos(0),length(0), count = 0;
constint MAX = 10; // max number of characters on one line
char input[MAX];
int size;
cout << "Enter a sentence: " << endl;
cin.getline(input, MAX, '\n');
if (size > MAX)
{cout << "Exceeded the maximum amount of characters (MAX 100)";}
else
{
while(input[count] != '\0')
{
input[count];
count ++;
}
for (int i = 0; i < input[count]; i++)
{}
}
cout << endl;
system("PAUSE");
return 0;
}