I'm making a program for class that needs to ask
1) How many points on a graph there are.
int n;
cout<<"enter number of points on graph";
cin>>n;
2)Ask for the x and y values for each point based on the number of points.
Output would be:
Enter X_1:
Enter Y_1:
Enter X_2:
Enter Y_2:
Enter X_n:
Enter Y_n:
How would I go about getting this set up. I'm guessing something like:
for(int k=1; k<=n; k++)
{
cout<<"Enter the value of x_"<
cin>> ; <--- What goes here?
cout<<"Enter the value of y_"<
cin>> " <---What goes here?
}
Thats probably wrong, but I just don't know how to start it out to do it right and to have each number maintain the input value.
2007-02-07
11:40:31
·
2 answers
·
asked by
?
2
in
Computers & Internet
➔ Programming & Design