// Includes
#include "stdafx.h"
#include <iostream>
#include <conio.h>
usingnamespace std;
// Main Function
int main()
{
int x;
int y;
cout << "This program wil display an arrowhead on the screen.\n\n";
for ( x = 1; x <= 7; x = x + 2)
{
for ( y = 0; y <= 13; y++)
{
cout << "+";
}
cout << endl;
}
for ( x = 5; x > 0; x = x - 2)
{
for ( y = x; y > 0; y--)
{
cout << "+";
}
cout << endl;
}
_getch();
return 0;
+
+++
+++++
+++++++++++++
+++++
+++
+
}
// Includes
#include "stdafx.h"
#include <iostream>
#include <conio.h>
usingnamespace std;
// Main Function
int main()
{
int x;
int y;
cout << "This program wil display an arrowhead on the screen.\n\n";
for ( x = 1; x <= 5; x = x + 2)
{
cout << " ";
for ( int i = 0; i < 8; i++)
{
cout<< "+";
}
cout << endl;
for ( y = 1; y < 8; y++)
{
cout << "+";
}
cout << endl;
}
for ( x = 7; x > 0; x = x - 2)
{
cout << " ";
for ( y = x; y > 0; y--)
{
cout << "+";
}
cout << endl;
}
_getch();
return 0;
+++++++++
++++++++
+++++++++
++++++++
++++++++
++++++++
+++++++
+++++
+++
+
}
//For first part
for(int i=0 ; i<3;i++){
//For spaces
int k=0;
while(k<4){
cout << " ";
k++;
}
//For + sign
for(int j=0 ; j<=i ; j++){
cout << "+";
}
cout << endl;
}
//For middle part
....try on your own
//For third part
...try on your own
Try writing comments while making patterns as to what each part is supposed to do . It will help you to understand it later.
thank you raman009, that was alot of help, at last i got it, i made the arrows longer, i mean longer going across, heres the code feel free to run it and see how it looks.
// Includes
#include "stdafx.h"
#include <iostream>
#include <conio.h>
usingnamespace std;
// Main Function
int main()
{
cout << "This program wil display an arrowhead on the screen.\n\n";
// For first part
for (int i = 0 ; i < 3 ; i++)
{
// For spaces
int k = 0;
while (k < 8)
{
cout << " ";
k++;
}
// For + sign
for (int j = 0 ; j <= i ; j++)
{
cout << "+";
}
cout << endl;
}
// For second part
for (int l = 0 ; l < 1 ; l++)
{
// For + sign
for (int m = 0 ; m <= 11 ; m++)
{
cout << "+";
}
cout << endl;
}
// For third part
for (int n = 3 ; n > 0 ; n--)
{
// For spaces
int o = 8;
while (o > 0)
{
cout << " ";
o--;
}
// For + sign
for (int p = n ; p > 0 ; p--)
{
cout << "+";
}
cout << endl;
}
_getch();
return 0;
}