Let us see the numbers program with user define function and structures.
#include<iostream> using namespace std; struct counting { int i; int j; int k=0; }; void displaydata(counting); int main(){ counting c; displaydata(c); return 0; } void displaydata(counting c){ for(c.i=0;c.i<=10;c.i++){ for(c.j=1;c.j<c.i;c.j++){ printf("%d",c.k); c.k++; } printf("\n"); } }
Output