so i need to make this:
(the pipes line up with the "+" signs)
+===+===+
| | |
| | |
| | |
+===+===+
| | |
| | |
| | |
+===+===+
And the problem is making the "pipes" go down by three. i am trying to make it so that the random number generator, generates a number by which to scale the output by. i cannot figure it out. thanks if you can help.
if it doesn't work that way let me know too.
#include <iostream>
#include <ctime>
#include <cstdlib>
usingnamespace std;
void windows();
int main()
{
windows();
return 0;
}
void windows()
{
int a;
srand(time(0));
a = rand()%7+1;
int i = a;
int f = a;
int z = a;
for (i=0; i < a; i++)
{
cout << "+";
if (i < a - 1)
{
for (z = 0; z <a; z++)
cout << "=";
}
}
cout << endl;
for (i=0;i<a; i++)
{
cout << "|";
for ( f=0; f < a; f++)
{
cout << " ";
}
}
cout <<endl;
for (i=0; i<a; i++)
{
cout << "+";
if (i < a - 1)
{
for(z=0; z < a; z++)
cout << "=";
}
}
cout << endl;
}
// Nested for loops.cpp : main project file.
#include <iostream>
#include <ctime>
#include <cstdlib>
usingnamespace std;
void windows();
int main()
{
windows();
return 0;
}
void windows()
{
srand((unsigned)time(0));
int a = 1 + rand() % 7;
// Removed, as they are not being used. Just the variable was, NOT the values
//int i = a;
//int f = a;
//int z = a;
for (int i = 0; i < a; i++)
{
cout << "+";
if (i < a - 1)
{
for (int z = 0; z <a; z++)
cout << "=";
}
}
cout << endl;
for (int twice = 1; twice < a; twice++)
{
for (int x = 0; x < 3; x++)// Make box, 3 high
{
for (int i = 0; i < a; i++)
{
cout << "|";
for (int f = 0; f < a; f++)
{
cout << " ";
}
}
cout << endl;
}
for (int i = 0; i < a; i++)
{
cout << "+";
if (i < a - 1)
{
for (int z = 0; z < a; z++)
cout << "=";
}
}
cout << endl;
}
}