0
can someone tell me a programme to output this kind of pattern : ?***? ?*? ?
3 Respostas
+ 3
#include<iostream>
using namespace std;
int main()
{
for(int loop=1;loop<=3;loop++)
{
for(int i=1;i<=loop-1;i++)
cout<<" ";
for(int p=loop;p<=6-loop;p++)
{
if(p==loop||p==6-loop)cout<<"?";
else cout<<"*";
}
cout<<"\n";
}
return 0;
}
+ 3
Edited.
int i, j, n;
n = 2;
for (i = 0; i <= n; i++) {
for (j = 0; j < i; j++) {
cout << " ";
}
cout << "?";
for (j = 0; j < (n-i)*2-1; j++) {
cout << "*";
}
if (i != n) {
cout << "?";
}
for (j = 0; j < i; j++) {
cout << " ";
}
cout << endl;
}
0
thanks! I'll try it out in a bit :)