+ 1

Print Reverse Triangle Bridge Pattern for Characters in C++.

10th Dec 2017, 5:56 PM
Harshit Vats
2 Answers
+ 9
can you tell us what is triangle bridge pattern?
10th Dec 2017, 6:07 PM
Vukan
Vukan - avatar
+ 1
// CPP program to print reverse character bridge pattern #include <iostream> using namespace std;    // Function to print pattern void ReverseCharBridge(int n) {     for (int i = 0; i < n; i++)      {         for (int j = 'A'; j < 'A' + (2 * n) - 1; j++)          {             if (j >= ('A' + n - 1) + i)                 cout << (char)(('A' + n - 1) -                                 (j % ('A' + n - 1)));             else if (j <= ('A' + n - 1) - i)                 cout << (char)j;             else                 cout << " ";         }         cout << endl;     } }    // Driver Code int main() {     int n = 6;     ReverseCharBridge(n);     return 0; }
16th May 2019, 3:02 PM
Harshit Vats