Skip to content

Instantly share code, notes, and snippets.

@ravichandrae
Created February 26, 2016 14:01
Show Gist options
  • Save ravichandrae/8e7c0d4fc6abc9aab6a2 to your computer and use it in GitHub Desktop.
Save ravichandrae/8e7c0d4fc6abc9aab6a2 to your computer and use it in GitHub Desktop.
Printing the given string as a cross mark
#include <iostream>
using namespace std;
int main() {
string input="12345";
int len = input.size();
int i,j;
for( i = 0; i < len; i++)
{
for( j = 0; j < len; j++)
{
if( i == j || j == len-i-1)
cout << input[i];
else
cout << " ";
}
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment