English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

can anyone help me how to write a c++ program to get the output like this:

* * * *
* *
* * * *

(use array and for)
the question wants me to use for and array..not just using cout<<"* * * *"<

2007-03-21 20:10:35 · 3 answers · asked by ct_nurani85 1 in Computers & Internet Programming & Design

3 answers

#include
#include

using namespace std;

int main (void)
{
string arr [] = { "****" , "**" , "****" };
for (int i = 0; i < 3; i++) cout << arr[i] << endl;
system("pause");
return EXIT_SUCCESS;
}

2007-03-21 20:43:10 · answer #1 · answered by Coosa 2 · 0 0

well i can give u the pseudocode

create an array with length 9 that contain '*'s

for (i=0;i {
cout< if ((i=3)or(i=5))
{
count<<"\n";
}
}

2007-03-21 20:40:06 · answer #2 · answered by 14Me14U 2 · 0 0

u can use while loop for it. self try now for graphic design.

2007-03-21 21:31:27 · answer #3 · answered by AVDHESH CHAUHAN 1 · 0 0

fedest.com, questions and answers