C++ Help (Integer Pattern) <p>The Question :</p> <p>If the sequence of digits in X forms a substring of the sequence of digits in Y, it outputs "X is a substring of Y"; otherwise, if the sequence of digits in X forms a subsequence of the sequence of digits in Y, then it outputs "X is a subsequence of Y"; otherwise, it outputs "X is neither substring nor subsequence of Y".</p> <p><strong>DO NOT</strong> use arrays or strings in this program</p> <p>The output should be as follows </p> <hr> <p>Enter Y : 239847239 </p> <p>Enter X : 847</p> <p>X is substring of Y</p> <p>Enter Y : 239847239</p> <p>Enter X : 3923</p> <p>X is subsequence of Y</p> <p>Enter Y : 239847239</p> <p>Enter X : 489</p> <p>X is neither substring nor subsequence of Y</p> <hr> <p>And below is what I got so far... (haven't coded anything for subsequence as i was clueless)</p> <p>I know my coding is very unefficient and is only suitble to use for the above model output. Any improvements or comments how to fix this would be greatly appreciated.</p> <pre><code> #include &lt;cmath&gt; #include &lt;iostream&gt; using namespace std; int main() { cout &lt;&lt; "Enter Y: " ; int Y; cin &gt;&gt; Y; cout &lt;&lt; "Enter X: "; int X; cin &gt;&gt; X; if (Y &gt;= X){ // Below are all the possibilities of substrings up to 9 decimal places. if( X == (Y % 10)) cout &lt;&lt; "X is substring of Y"; else if (X == (Y % 100)) cout &lt;&lt; "X is substring of Y"; else if (X == (Y % 1000)) cout &lt;&lt; "X is substring of Y"; else if (X == (Y % 10000)) cout &lt;&lt; "X is substring of Y"; else if (X == (Y % 100000)) cout &lt;&lt; "X is substring of Y"; else if (X == (Y % 1000000)) cout &lt;&lt; "X is substring of Y"; else if (X == (Y % 10000000)) cout &lt;&lt; "X is substring of Y"; else if (X == (Y % 100000000)) cout &lt;&lt; "X is substring of Y"; else if (X == (Y % 1000000000)) cout &lt;&lt; "X is substring of Y"; else cout &lt;&lt; "X is neither substring nor subsequence of Y"; } else cout &lt;&lt; "neither subsequence nor subset"; // prints out when Y is less than X. return 0; </code></pre> <p>}</p>