Jun 22, 2016 at 2:34am UTC
I have a proyect for saturday, the exercise is about a menu with 5 options.
the option number 1 concist in making an square of asterisks with a number that the user is suppost to give at the begining,and the asteriks needs to apper just in the corners of the screen making full square, for example if the user put 3 the square needs to be with the size 3x3 like this
***
* *
***
Jun 22, 2016 at 3:04am UTC
Excellent. Are you having problems with it? If you are show us your work so far and we'll try and help you out. :)
Jun 23, 2016 at 12:05am UTC
I see what you have to do here, provide your code sample and show us what you're having trouble on, we wont just give you the answers my friend.
Jun 26, 2016 at 1:10am UTC
#include "stdafx.h"
#include <iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main()
{
int menu = 0;
cout << "1 Primer ejercicio" << endl
<< "2 Segundo ejercicio" << endl
<< "3 Tercer ejercicio" << endl
<< "4 Cuarto ejercicio" << endl
<< "5 Salir" << endl;
cin >> menu;
if (menu == 1)
{
int n;
cout << "digite la medida del lado del cuadrado";
cin >> n;
for (int fila = 1; fila <= n; fila++)
{
for (int columna = 1; columna <= n; columna++)
{
if (fila== columna == n)
{
cout << "*" << endl;
}
else
{
cout << " " << endl;
}
}
}
}
system ("pause");
return 0;
}
Jun 26, 2016 at 1:11am UTC
btw, the excercise is in spanish because I´m from costa rica, if you don't understand something please tell me
Jun 26, 2016 at 1:16am UTC
i have troubles whit the if
Jun 26, 2016 at 1:19am UTC
if (fila== columna == n)
is equivalent to if ((fila == columna) == n)
What did you mean to accomplish there?
Jun 26, 2016 at 1:30am UTC
if (int n; fila = 1 && columna = 1)
if the first line and the first colum is equal to 1, the sistem will put an *