I am still relatively new to learning c++ and I need help fixing my code so it will work properly.
The problem given:
Input a number then make an X in the following way:
for instance, if you input a 5 (odd number),
5----5
-4--4
---3
-2--2
1----1
And if you input an even number, such as 4,
1--1
-22
-33
4--4
(there should be spaces instead of -)
So far the outputs for even numbers are working just fine, but the outputs for odd numbers look more like a Y than a full X. This is my code:
#include <iostream> //Input/Output objects
using namespace std; //Name-space used in the System Library
int main(int argc, char** argv) {
//Declaration of Variables
int num; //number
//Input values
cout<<"Enter an integer: "<<endl;
cin>>num;