can someone pllllllllllllllllz help me with this!!!!!!!!
my problem is
i have to write a c++ program that inputa a character and an integer. The out put should be a diamond composed of the character and extencing the widht specified byt he integer. for example, if the integer is 11 and the character is an asterisk (*), the diamond would look like this:
if the input integer is an even number, it should be increased to the next odd number.Code:* *** ***** ******* ********* *********** ********* ******* ***** *** *
i have tried this out..but i think my logic is wrong...pliz help me on this
[b]Code Tags added by Kermi3[/code]Code:# include <iostream> using namespace std; int main() { int n, r, oddInt; char c; // Get int and char cout << "Enter number of rows: "<< flush; cin >> n; cout << "Enter a character: "<< flush; cin >> c; // determine whether n is odd or even if (n > 1 && n < 23) { oddInt = 3; while ( oddInt <= 23) { oddInt = oddInt + 1; } } else if ( n < 1 && n > 23) { cout << "Illegal integer"<< endl; } // draw triangle // r = row // s = space r= 1; while ( r <= n) { c = 1; while (c <= r ) { cout << c; c++; } r++; cout << endl; } return 0; }



LinkBack URL
About LinkBacks



