Posted: . At: 9:24 PM. This was 11 years ago. Post ID: 6178
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.
This code prints out a tick sign using asterisks. I tested this code on Fedora 19 and gcc 4.8 and it compiles without any problems.
#include <iostream>
#include <iomanip>
using std::cout;
int main() {
cout<<std::setw(8)<<"*"<<"n";
cout<<std::setw(7)<<"*"<<"n";
cout<<std::setw(6)<<"*"<<"n";
cout<<"* *"<<"n"<<"* *"<<"n"<<"*";
cout<< "n";
return 0;
} |
#include <iostream>
#include <iomanip>
using std::cout;
int main() {
cout<<std::setw(8)<<"*"<<"n";
cout<<std::setw(7)<<"*"<<"n";
cout<<std::setw(6)<<"*"<<"n";
cout<<"* *"<<"n"<<"* *"<<"n"<<"*";
cout<< "n";
return 0;
}
This is what you should get when you compile and run this code sample.
homer@neo $ ./loop
*
*
*
* *
* *
* |
homer@neo $ ./loop
*
*
*
* *
* *
*
Very cool indeed.