hello all;
this is the code that I'm getting.
http://i109.photobucket.com/albums/n...z13/graph1.jpg
this is what it should look like:
http://i109.photobucket.com/albums/n...nz13/graph.jpg
this is my code can someone plz take a look and tell me how to fix the graphs, so they can appear like the over link, and how to fix the warning that are appearing,thanks.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main ()
{
ofstream outputFile;
outputFile.open("prog2_.txt"); //outputfile
int choice;
cout<<endl<<" Maths function plotter"; //Heading to program
cout<<endl<<"---------------------------------------";
cout<<endl<<"1. Plot function 1 3.5*sin(2*pi*t/8)\n"; //choice for plotting function 1
cout<<"2. Plot function 2 sqrt(t)\n"; //choice for plotting function 2
cout<<"3. Plot function 3 (At^2+Bt+C)/(t^2+1)\n"; //choice for plotting function 3
cout<<"4. Quit Program\n"<<endl; //choice for quiting program
cout<<"Make A Selection From The Menu: "; //user enters selection
cin>>choice;
{
if (choice==1) //Input selection made by user
{ const double pi = 3.141592654;
int i, j, x, y; //pi = 3.141592654;
//numbers of rows and columns in graph
const int row = 21;
const int col = 76;
char plot[row][col];
{
for (j = 20; j > -1; j--)
for (i = 1; i < col; i++)
plot[j][i] = '.';
}
cout << endl;
{
for (x = 0; x < 76; x++)
{
y = 3.5*sin(2.0*pi*x/8.0); //15*sin(2*pi*x/24)
plot[y][x] = '*';
cout << x << " " << y << endl;
}
}
{
for (j = 20; j > -1; j--)
{
for (i = 1; i < col; i++)
cout << plot[j][i];
cout << endl;
}
}
cout << endl;
return 0;
}
}
if(choice==4) //if user choice is 4
{
cout<<"Time to say good bye, THE END. "<<endl;
cout<< "Now writing information to the file.\n"; //writes information to the output file
outputFile<< " Student name : "<<endl;
outputFile<< " Student ID : " <<endl;
outputFile.close();
cout<<"Done.\n";
}
return EXIT_SUCCESS;
}