Foa a bonus question. /*My professior asked us to write a program which outputs a hollow square*/
Example: ****
****
****
****
OR ******
* *
* *
* *
******
Foa a bonus question. /*My professior asked us to write a program which outputs a hollow square*/
Example: ****
****
****
****
OR ******
* *
* *
* *
******
/* uhh, like this? */
Code:for(int i = 0; i < 5; i ++) for(int t = 0; t < 5; t ++) cout << '*';
I am against the teaching of evolution in schools. I am also against widespread
literacy and the refrigeration of food.
No, more like this:
-PreludeCode:#include <iostream> #include <iomanip> using std::cout; using std::endl; using std::setw; using std::setfill; int main() { int h = 5; cout<< setw ( h * 2 ) << setfill ( '*' ) <<""<<endl; for ( int i = 0; i < h; i++ ) cout<<'*'<< setw ( h * 2 - 1 ) << setfill ( ' ' ) <<'*'<<endl; cout<< setw ( h * 2 ) << setfill ( '*' ) <<""<<endl; }
My best code is written with the delete key.
here is a more noobie type approach...
Code:int main() { int size; cout << "Enter the box size "; cin >> size; cout << endl; for(int i = 0; i < size; i++) cout << "* "; cout << endl; for(int i = 0;i < size-2; i++) { for(int j = 0;j <= size; j++) { if(j%size == 0) cout << '*'; else if(j == size-1) cout << ' '; else cout << " "; } cout << endl; } for(int i = 0; i < size; i++) cout << "* "; return 0; }
so have we resorted to doing people's homework for them?
I don't mind helping if code is posted with an attempt
>so have we resorted to doing people's homework for them?
Only if I'm sure that their instructor would refuse to take my code (ie. too sophisticated of a solution, uses features that haven't been taught yet, uses restricted features, obviously not written by the student).
-Prelude
My best code is written with the delete key.
okay, that makes sense.Originally posted by Prelude
>so have we resorted to doing people's homework for them?
Only if I'm sure that their instructor would refuse to take my code (ie. too sophisticated of a solution, uses features that haven't been taught yet, uses restricted features, obviously not written by the student).
-Prelude
Still have your "triangle" code somewhere on a CD and I confess to doing some "scrambling" on that one. Very sweet.Originally posted by Prelude
Only if I'm sure that their instructor would refuse to take my code (ie. too sophisticated of a solution, uses features that haven't been taught yet, uses restricted features, obviously not written by the student).
This one's playing it a little "closer to the vest", though, isn't it?
Not a criticism, but more an opportunity to say that it's great having you back! And, you didn't return the optional zero. (Pardon me for waxing nostalgic... )
-Skipper
"When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow
Or maybe he'll (she'll) get a better grade for the advanced concepts, heh.Originally posted by Prelude
>so have we resorted to doing people's homework for them?
Only if I'm sure that their instructor would refuse to take my code (ie. too sophisticated of a solution, uses features that haven't been taught yet, uses restricted features, obviously not written by the student).
-Prelude
//napKIN
"The best way to get answers is to just keep working the problem, recognizing when you are stalled, and directing the search pattern.....Don’t just wait for The Right Thing to strike you – try everything you think might even be in the right direction, so you can collect clues about the nature of the problem."
-John Carmack