***** help me solve all these if possible.... especially don't miss the circle one *** thanks
/// The following program displays a 9*9 matrix.
#include <iostream>
using namespace std;
int main()
{
const int SIZE = 9;
for (int row = 0; row < SIZE; i++)
{
for (int col = 0; col < SIZE; j++)
{
cout << "*";
}
cout << endl;
}
}
///
/// Step 1: Could you change size of the matrix to 3*10 or
10*3?
///
///
/// Step 2: Display a pattern like the following figure when SIZE
is 9.
///
/// *
/// *
/// *
/// *
/// *
/// *
/// *
/// *
/// *
///
/// Step 3: Display a pattern like the following figure when SIZE
is 9.
///
/// *********
/// ********
/// *******
/// ******
/// *****
/// ****
/// ***
/// **
/// *
///
/// Step 4: Display a pattern like the following figure when SIZE
is 9.
///
///
/// *
/// **
/// ***
/// ****
/// *****
/// ******
/// *******
/// ********
/// *********
///
/// Step 5: Display a pattern like the following figure when SIZE
is 9.
///
/// *********
/// *******
/// *****
/// ***
/// *
/// ***
/// *****
/// *******
/// *********
///
/// Step 6: Display a pattern like the following figure when SIZE
is 9.
///
/// *********
/// * *
/// * *
/// * *
/// * *
/// * *
/// * *
/// * *
/// *********
///
///
/// Step 7: Display a pattern like the following figure when SIZE
is 9.
///
/// *+*+*+*+*
/// *+*+*+*+*
/// *+*+*+*+*
/// *+*+*+*+*
/// *+*+*+*+*
/// *+*+*+*+*
/// *+*+*+*+*
/// *+*+*+*+*
/// *+*+*+*+*
///
///
/// Step 8: Display a pattern like the following figure in the case
that the size is odd. That is,
/// the boundaries are drawn and there is a cross of single line in
the middle. (The
/// following figure shows a case in which the size is 9.)
///
/// *********
/// * * *
/// * * *
/// * * *
/// *********
/// * * *
/// * * *
/// * * *
/// *********
///
/// In the case that the size is even, the display is like the
following figure.
/// That is, the boundaries are drawn and there is a cross of
double lines in the middle.(The
/// following figure shows a case in which the size is 10.)
///
/// **********
/// * ** *
/// * ** *
/// * ** *
/// **********
/// **********
/// * ** *
/// * ** *
/// * ** *
/// **********
///
///
/// Step 9: Display a pattern like the following figure when SIZE
is 9.
///
/// *-*-*-*-*
/// -*-*-*-*-
/// *-*-*-*-*
/// -*-*-*-*-
/// *-*-*-*-*
/// -*-*-*-*-
/// *-*-*-*-*
/// -*-*-*-*-
/// *-*-*-*-*
///
/// Step 10: Display a pattern like the following figure when SIZE
is 9.
///
/// *********
/// * *
/// * ***** *
/// * * * *
/// * * * * *
/// * * * *
/// * ***** *
/// * *
/// *********
///
/// Step 10: Display a Spray pattern like the following figure when
SIZE is 9.
/// Spray has shape of circle. Inside the boundry the dotts
randomly appear.
/// You can refer to the Spray tool in Paint to know how Spary
work.
///
/// ++++++++++++++++++
/// + * * +
/// + * * * ** +
/// + * ** * ** * +
/// + * * *** ** * * +
/// + * ** **** * +
/// + * * * **** +
/// + * * ** +
/// ++++++++++++++++++
///
/// The following program draws a circle with the provided radius.
You may use
/// this as a base for completeing the Spray pattern.
///
#include <iostream>
using namespace std;
void drawCircle(float r)
{
float pr = 2; // pr is the aspected pixel ratio which is almost
equal to 2
for (int i = -r; i <= r; i++) // loop for horizontal
movement
{
for (int j = -r; j <= r; j++) // loop for vertical
movement
{
float d = ((i*pr)/r)*((i*pr)/r) + (j/r)*(j/r); //multiplying the i
variable with pr to equalize pixel-width with the height
if (d >0.95 && d<1.08) // approximation
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
}
int main()
{
float r;
cout<< " Enter the Radius" <<endl;
cin>> r;
drawCircle(r);
return 0;
}
Please find the code below:
#include <iostream>
using namespace std;
void drawCircle(float r)
{
int rep = r;
if(rep%2==0){
rep = -1;
}else{
rep = 0;
}
float pr = 2; // pr is the aspected pixel ratio which is almost equal to 2
for (int i = -r/2; i <= r/2; i++) // loop for horizontal movement
{
for (int j = 0; j <= r; j++) // loop for vertical movement
{
float d = ((i*pr)/r)*((i*pr)/r) + (j/r)*(j/r); //multiplying the i variable with pr to equalize pixel-width with the height
if (d<1.08) // approximation
{
cout << "*";
}
else
{
cout << " ";
}
}
cout << endl;
}
}
void step1(){
cout<<"STEP 1"<<endl;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 10; j++)
{
cout << "*";
}
cout << endl;
}
cout<<endl;
cout<<endl;
}
void step2(){
cout<<"STEP 2"<<endl;
const int SIZE = 9;
for (int i = 0; i < SIZE; i++)
{
cout << "*";
cout << endl;
}
cout<<endl;
}
void step3(){
cout<<"STEP 3"<<endl;
const int SIZE = 9;
for (int i = 0; i < SIZE; i++)
{
for (int j = i; j < SIZE; j++)
{
cout << "*";
}
cout<<endl;
}
cout<<endl;
}
void step4(){
cout<<"STEP 4"<<endl;
const int SIZE = 9;
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < i+1; j++)
{
cout << "*";
}
cout<<endl;
}
cout<<endl;
}
void step5(){
cout<<"STEP 5"<<endl;
const int SIZE = 9;
for (int i = 0; i < SIZE; i++)
{
if(i<=SIZE/2){
for (int j = 2*i; j < SIZE; j++)
{
cout << "*";
}
}else{
for (int j = SIZE/2; j < 2*i+1-SIZE/2; j++)
{
cout << "*";
}
}
cout<<endl;
}
cout<<endl;
}
void step6(){
cout<<"STEP 6"<<endl;
const int SIZE = 9;
for (int i = 0; i < SIZE; i++)
{
if(i==0 || i==SIZE-1)
for (int j = 0; j < SIZE; j++)
{
cout << "*";
}
else
cout<<"**";
cout<<endl;
}
cout<<endl;
}
void step7(){
cout<<"STEP 7"<<endl;
const int SIZE = 9;
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < SIZE; j++)
{
if(j%2==0)
cout << "*";
else
cout<<"+";
}
cout<<endl;
}
cout<<endl;
}
void stepSpray10(){
cout<<"STEP 10 Spray"<<endl;
const int SIZE = 9;
int rep = SIZE;
if(rep%2==0){
rep = -1;
}else{
rep = 0;
}
float r = SIZE;
float pr = 2; // pr is the aspected pixel ratio which is almost equal to 2
for(int i=0;i<SIZE*1.5;i++)
cout<<"+";
cout<<endl;
for (int i = -r/2; i <= r/2; i++) // loop for horizontal movement
{
bool star = 1;
for (int j = 0; j <= r; j++) // loop for vertical movement
{
if(j==0)
cout<<"+";
float d = ((i*pr)/r)*((i*pr)/r) + (j/r)*(j/r); //multiplying the i variable with pr to equalize pixel-width with the height
if (d<1.08) // approximation
{
cout << "*";
}
else
{
if(star==1){
cout<<"+";
star=0;
}else
cout << " ";
}
}
cout << endl;
}
for(int i=0;i<SIZE*1.5;i++)
cout<<"+";
cout<<endl;
cout<<endl;
}
int main()
{
step1();
step2();
step3();
step4();
step5();
step6();
step7();
stepSpray10();
return 0;
}
AS due to lack of time able to provide till 1 to 7 and last.
***** help me solve all these if possible.... especially don't miss the circle one *** thanks...
Subject: Object Oriented Programming (OOP) Please kindly solve the above two questions as soon as possible would be really grateful to a quick solution. would give a thumbs up. Thank you! Q3: Question # 3 [20] Will the following code compile? If it does not, state the errors. If it does compile, write the output. //Function.cpp #include <iostream> using namespace std; void printData (long i) cout<<"In long print Data "«<i<<endl; } void printData(int i) cout<<"In int printData "<<i<<endl; ) void...
Program is in C++, program is called airplane reservation. It is suppose to display a screen of seating chart in the format 1 A B C D E F through 10. I had a hard time giving the seats a letter value. It displays a correct screen but when I reserve a new seat the string seats[][] doesn't update to having a X for that seat. Also there is a file for the struct called systemUser.txt it has 4 users...
Can somebody help me with this coding the program allow 2 players play tic Tac Toe. however, mine does not take a turn. after player 1 input the tow and column the program eliminated. I want this program run until find a winner. also can somebody add function 1 player vs computer mode as well? Thanks! >>>>>>>>>>>>>Main program >>>>>>>>>>>>>>>>>>>>>>> #include "myheader.h" int main() { const int NUM_ROWS = 3; const int NUM_COLS = 3; // Variables bool again; bool won;...
Id: 40100885 in c++ output text please thanks! what is the output values printed by the following code? You need to explain step by step how each printed value is calculated. #include <iostream> using namespace std; int m = 0; void SampleMethod (int); int SampleMethod(); void increase(); int main() { int j = 9; SampleMethod(j); cout << j<<endl; return 0; w Y == void SampleMethod(int i) { if (j%2 1) cout << SampleMethod() <<endl; else cout << j << "...
I need help fixing this code and adding a loop please. Here is the original problem: #include <iostream> using namespace std; //function to print seating chart void printSeatingChart(int **chart) { int i, j; cout << "\nROW\t"; for (i = 1; i <= 10; i++) { cout << i << "\t"; } cout << "\n-----------------------------------------------------------------------------------\n"; for (i = 8; i >= 0; i--) { cout << "\n" << i + 1 << "\t"; for (j = 0; j < 10; j++) ...
I need to update this C++ code according to these instructions. The team name should be "Scooterbacks". I appreciate any help! Here is my code: #include <iostream> #include <string> #include <fstream> using namespace std; void menu(); int loadFile(string file,string names[],int jNo[],string pos[],int scores[]); string lowestScorer(string names[],int scores[],int size); string highestScorer(string names[],int scores[],int size); void searchByName(string names[],int jNo[],string pos[],int scores[],int size); int totalPoints(int scores[],int size); void sortByName(string names[],int jNo[],string pos[],int scores[],int size); void displayToScreen(string names[],int jNo[],string pos[],int scores[],int size); void writeToFile(string...
Hello I need help fixing some things so that the C++ code follows all the requirements listed below. Thanks, This needed to fix: Rule 3 (Not Satisfied): In rule 3 it is asked to use conditional statements only for the base-case and for all other conditional expressions you must use ternary operators. You have used "if", "else" statements multiple times so this rule was not satisfied. Rule 6 (Not Satisfied): As per this rule you are permitted to use upto...
Can you tell me what is wrong and fix this code. Thanks #include <iostream> #include <string> #include <fstream> #include <sstream> using namespace std; //function void displaymenu1(); int main ( int argc, char** argv ) { string filename; string character; string enter; int menu1=4; char repeat; // = 'Y' / 'N'; string fname; string fName; string lname; string Lname; string number; string Number; string ch; string Displayall; string line; string search; string found; string document[1000][6]; ifstream infile; char s[1000];...
C++ programming question will upvote A) One of the problems that have been discussed in the class is to write a simple C++ program to determine the area and circumference of a circle of a given radius. In this lab you will be rewriting the program again but this time you will be writing some functions to take care of the user input and math. Specifically, your main function should look like the following int main //the radius of the...
In C++: Please help me correct this code .... All parts with (FIX ME) #include <algorithm> #include <climits> #include <iostream> #include <string> // atoi #include <time.h> #include "CSVparser.hpp" using namespace std; //============================================================================ // Global definitions visible to all methods and classes //============================================================================ const unsigned int DEFAULT_SIZE = 179; // forward declarations double strToDouble(string str, char ch); // define a structure to hold bid information struct Bid { string bidId; // unique identifier string title; string fund; double amount; Bid() {...