C++ Programming Problem #2 : Descending Numbers (Rotated Half Triangle Shape)

Problem # 2: Descending Numbers (Rotated Half Triangle Shape)
//---www.skellainnovations.com---//
#include <iostream.h>
#include <conio.h>
#define ct cout
void dec(int x);
int main() {
clrscr();
int x;
ct<<"Enter a Number: ";
cin>>x;
dec(x);
getch();
return 0; }
void dec(int x) {
int a,b;
for(a=x;a>=1;a--) {
for(b=a;b>=1;b--) {
ct<<b; }
ct<<endl; } }
//---www.skellainnovations.com---//
Breakdown of Codes
Additional Components Used
Define Directive
Descending Numbers (Rotated Half Triangle Shape) : Define Directive
#define ct cout
-
This is how to manipulate the identifier. For example, changing the built-in method cout, you can change it intoct which will be (#define ct cout) when you type it in your program.
#define identifier replacement
LEGEND : change
Breakdown of Codes : In the Deeper Side of the Process
Void Function Called
Descending Numbers (Rotated Half Triangle Shape) : Void Function Called
void dec(int x) {
int a,b;
for(a=x;a>=1;a--) {
for(b=a;b>=1;b--) {
ct << b; }
ct << endl; }
//end of function


April 23, 2017 @ 12:14 pm
Good job making it appear easy.
April 26, 2017 @ 9:44 am
my pleasure.