Answer to Question #274545 in C++ for Dylo

Question #274545

C++ program that outputs a triangle pattern using two nested do...while loops.The number of loops should only be two.


1
Expert's answer
2021-12-03T00:37:14-0500
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
     int n;
	 int R;
	 char ch;
	 //do while loop
     do// do 
	 {
		 cout << "Enter an integer" << endl;
		 cin >> n;
		 cout << "Enter symbol" << endl;
		 cin >> ch;
	 
		for(R=0;R<n;R++)
		 {
		 for (int A=0; A<=R;A++)
		 {
            cout<<ch;
            }
            for (int len=n;len>R+1;len--)
            cout<<" ";
            cout<<endl;
            }
            cin.ignore();
            cin.ignore();
            } 
    while(cin);//while
	return 0;
}
#include <iostream>


using namespace std;


int main()
{
    cout<<"Hello World";


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment