Sunday, November 3
C++ Diamond Printing Program Assignment
A program which takes from user, the input of number of lines and prints a diamond
From Saeed Rehman
Code:
Give a +1 for Saeed in comments and he might become a guest author :)
From Saeed Rehman
Code:
#includeusing namespace std; int main() { int a, b, c, d, e, f, g; cout << "enter num" << endl; cin >> a; for (b = 1; b <= a; b++) { for (c = 25 - b; c > 1; c--) cout << " "; for (d = 2 * b - 1; d >= 1; d--) cout << "*"; cout << endl; } for (b = a - 1; b >= 1; b--) { for (c = 25 - b; c > 1; c--) cout << " "; for (d = 2 * b - 1; d >= 1; d--) cout << "*"; cout << endl; } return 0; }
Give a +1 for Saeed in comments and he might become a guest author :)
there is a lot of effort in this code.
ReplyDelete+1 ,,,,, From my side
ReplyDelete