Graph

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 10

#include <iostream>

#include <cmath>
#include <cstring>
using namespace std;
double ans(int* x, int* n);
void solution(int* x, int* nth, char arr[][100]);
int main()
{

char array[100][100]{};
cout << "Enter the value of x for f(x)= x^n +x^n-1 ";
int num1;
cin >> num1;
cout << "Enter the value of n for f(x)= x^n +x^n-1 ";
int num2;
cin >> num2;

solution(&num1, &num2, array);

return 0;
}
double ans(int* x, int* n )
{
return pow(*x, *n) + pow(*x, *n - 1);
}
void solution(int* x, int* nth, char arr[][100])
{
int answer;
int y=ans(x,nth);
for (int i = 0; i < *x; i++)
{
answer = ans(&i, nth);
arr[i][answer]='.';
}
cout << ' ';
for (int i = 0; i <= *x; i++)
{
cout << i << ' ';
}
for (int i = 0; i <= y; i++)
{
cout << i << endl;
}

for (int i = 0; i < 100; i++)


{

for (int j = 0; j < 100; j++)


{
if (j != y)
{
cout << arr[i][j] << endl;
}
else { break; }
}
}

#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
int ans(int* x, int* n);
void solution(int* x, int* nth, char **box);
int main()
{

char **array=NULL;
cout << "Enter the value of x for f(x)= x^n +x^n-1 ";
int num1;
cin >> num1;
cout << "Enter the value of n for f(x)= x^n +x^n-1 ";
int num2;
cin >> num2;

solution(&num1, &num2, array);

delete[]array;
return 0;
}
int ans(int* x, int* n)
{
return pow(*x, *n) + pow(*x, *n - 1);
}
void solution(int* x, int* nth, char** box)
{

int y = ans(x, nth);


box = new char* [y];

for (int i = 0; i < y; i++)


{
char *box = new char[*x];
}

int answer;

/*for (int j = 0; j < *x; j++)


{
answer = ans(&j, nth);
*(*(box + answer) + j) = '.';
}*/

for (int i = 0; i < *x; i++)


{
for (int j = 0; j < y; j++)
{
*(*(box + i) + j) = 'f';
}

for (int i = 0; i < *x; i++)


{
for (int j = 0; j < y; j++)

{
cout << *(*(box + i) + j) <<' ';
}

}
//*cout << ' ';
//for (int i = 0; i <= *x; i++)
//{
// cout << i << ' ';
//}
//for (int i = 0; i <= y; i++)
//{
// cout << i << endl;
//}*/

//for (int i = 0; i < 100; i++)


//{

// for (int j = 0; j < 100; j++)


// {
// if (j != y)
// {
// cout << arr[i][j] << endl;
// }
// else { break; }
// }

#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
int ans(int* x, int* n);
void solution(int* x, int* nth, char **box);
int main()
{

char **array=NULL;
cout << "Enter the value of x for f(x)= x^n +x^n-1 ";
int num1;
cin >> num1;
cout << "Enter the value of n for f(x)= x^n +x^n-1 ";
int num2;
cin >> num2;
solution(&num1, &num2, array);

delete[]array;
return 0;
}
int ans(int* x, int* n)
{
return pow(*x, *n) + pow(*x, *n - 1);
}
void solution(int* x, int* nth, char** box)
{
int xaxis = *x;
int yaxis= ans(x, nth);
box = new char* [yaxis];

for (int i = 0; i < yaxis; i++)


{
box[i] = new char[xaxis];
}

int answer;

for (int j = 0; j < xaxis; j++)


{
answer = ans(&j, nth);
*(*(box + answer) + j) = '.';
}

/*for (int i = 0; i < yaxis; i++)


{
for (int j = 0; j < xaxis; j++)

{
*(*(box + i) + j) = 'f';
}

}*/

/*for (int i = 0; i < xaxis; i++)


{

for (int i = 0; i < yaxis; i++)


{
cout << i << ' ';
}

for (int i = 0; i < yaxis; i++)


{
for (int j = 0; j < xaxis; j++)

{
cout <<' ' << *(*(box + i) + j) ;
}
cout << endl;

}*/

for (int i = 0; i < xaxis; i++)


{
int answer = ans(&i, nth);
box[answer][i] = 'x'; // Use 'x' instead of '.' to mark the
specific point
}

//for (int i = 0; i < yaxis; i++) {


// for (int j = 0; j < xaxis; j++) {
// if (box[i][j] == 'x') {
// cout << box[i][j] << ' '; // Print 'x' for specific
points
// }
// else {
// cout << ans(&j, nth) << ' '; // Print the
corresponding number
// }
// }
// cout << endl;
//}
//*cout << ' ';
//for (int i = 0; i <= *x; i++)
//{
// cout << i << ' ';
//}
//for (int i = 0; i <= y; i++)
//{
// cout << i << endl;
//}*/

//for (int i = 0; i < 100; i++)


//{

// for (int j = 0; j < 100; j++)


// {
// if (j != y)
// {
// cout << arr[i][j] << endl;
// }
// else { break; }
// }

#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
int ans(int* x, int* n);
void solution(int* x, int* nth, char **box);
int main()
{

char **array=NULL;
cout << "Enter the value of x for f(x)= x^n +x^n-1 ";
int num1;
cin >> num1;
cout << "Enter the value of n for f(x)= x^n +x^n-1 ";
int num2;
cin >> num2;

solution(&num1, &num2, array);

delete[]array;
return 0;
}
int ans(int* x, int* n)
{
return pow(*x, *n) + pow(*x, *n - 1);
}
void solution(int* x, int* nth, char** box)
{
int xaxis = *x;
int yaxis= ans(x, nth);
box = new char* [yaxis];

for (int i = 0; i < yaxis; i++)


{
box[i] = new char[xaxis];
}

int answer;

for (int j = 0; j < xaxis; j++)


{
answer = ans(&j, nth);
*(*(box + answer) + j) = '.';
}

/*for (int i = 0; i < yaxis; i++)


{
for (int j = 0; j < xaxis; j++)

{
*(*(box + i) + j) = 'f';
}

}*/

/*for (int i = 0; i < xaxis; i++)


{

for (int i = 0; i < yaxis; i++)


{
cout << i << ' ';
}

for (int i = 0; i < yaxis; i++)


{
for (int j = 0; j < xaxis; j++)

{
cout <<' ' << *(*(box + i) + j) ;
}
cout << endl;

}*/

for (int i = 0; i < xaxis; i++)


{
int answer = ans(&i, nth);
box[answer][i] = 'x'; // Use 'x' instead of '.' to mark the
specific point
}

//for (int i = 0; i < yaxis; i++) {


// for (int j = 0; j < xaxis; j++) {
// if (box[i][j] == 'x') {
// cout << box[i][j] << ' '; // Print 'x' for specific
points
// }
// else {
// cout << ans(&j, nth) << ' '; // Print the
corresponding number
// }
// }
// cout << endl;
//}
//*cout << ' ';
//for (int i = 0; i <= *x; i++)
//{
// cout << i << ' ';
//}
//for (int i = 0; i <= y; i++)
//{
// cout << i << endl;
//}*/

//for (int i = 0; i < 100; i++)


//{

// for (int j = 0; j < 100; j++)


// {
// if (j != y)
// {
// cout << arr[i][j] << endl;
// }
// else { break; }
// }
}

#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
int ans(int* x, int* n);
void solution(int* x, int* nth, char **box);
int main()
{

char **array=NULL;
cout << "Enter the value of x for f(x)= x^n +x^n-1 ";
int num1;
cin >> num1;
cout << "Enter the value of n for f(x)= x^n +x^n-1 ";
int num2;
cin >> num2;

solution(&num1, &num2, array);

delete[]array;
return 0;
}
int ans(int* x, int* n)
{
return pow(*x, *n) + pow(*x, *n - 1);
}
void solution(int* x, int* nth, char** box)
{
int xaxis = *x;
int yaxis= ans(x, nth);
box = new char* [yaxis];

for (int i = 0; i < yaxis; i++)


{
box[i] = new char[xaxis];
}

int answer;

for (int j = 0; j < xaxis; j++)


{
answer = ans(&j, nth);
*(*(box + answer) + j) = '.';
}

/*for (int i = 0; i < yaxis; i++)


{
for (int j = 0; j < xaxis; j++)

{
*(*(box + i) + j) = 'f';
}

}*/

/*for (int i = 0; i < xaxis; i++)


{

for (int i = 0; i < yaxis; i++)


{
cout << i << ' ';
}

for (int i = 0; i < yaxis; i++)


{
for (int j = 0; j < xaxis; j++)

{
cout <<' ' << *(*(box + i) + j) ;
}
cout << endl;

}*/

for (int i = 0; i < xaxis; i++)


{
int answer = ans(&i, nth);
box[answer][i] = 'x'; // Use 'x' instead of '.' to mark the
specific point
}

//for (int i = 0; i < yaxis; i++) {


// for (int j = 0; j < xaxis; j++) {
// if (box[i][j] == 'x') {
// cout << box[i][j] << ' '; // Print 'x' for specific
points
// }
// else {
// cout << ans(&j, nth) << ' '; // Print the
corresponding number
// }
// }
// cout << endl;
//}
//*cout << ' ';
//for (int i = 0; i <= *x; i++)
//{
// cout << i << ' ';
//}
//for (int i = 0; i <= y; i++)
//{
// cout << i << endl;
//}*/

//for (int i = 0; i < 100; i++)


//{
// for (int j = 0; j < 100; j++)
// {
// if (j != y)
// {
// cout << arr[i][j] << endl;
// }
// else { break; }
// }

You might also like