Im new to programming, expecially c++. I started off in python but really just know the basics.
My question is, how would i go about writing a program that would output all of the numbers (whole numbers) on a plane between X and Y, saw 0,0 and 10,10?
I can get my code to write the basics from 0-10 with a while loop, but only for 1 axis.
[code=cpp]
#include<iostre am>
using std::cin;
using std::cout;
int main()
{
int upper_left;
int upper_right;
int lower_left;
int lower_right;
cout<<"Enter Upper Left ";
cin >>upper_left;
cout<<"Enter Upper Right ";
cin >>upper_right ;
cout<<"Enter Lower Left ";
cin>>lower_left ;
cout<<"Enter Lower Right ";
cin>>lower_righ t;
while (upper_left <= lower_left)
{
cout << upper_left <<"," << upper_right <<" ";
upper_left++;
}
[/code]
im not sure where to go from here? How would i move along the other axis.
Im sorry if this isnt clear, i have been up extremely late the past few nights and am running on little sleep. I would appreciate any help or pointers here. Thanks
My question is, how would i go about writing a program that would output all of the numbers (whole numbers) on a plane between X and Y, saw 0,0 and 10,10?
I can get my code to write the basics from 0-10 with a while loop, but only for 1 axis.
[code=cpp]
#include<iostre am>
using std::cin;
using std::cout;
int main()
{
int upper_left;
int upper_right;
int lower_left;
int lower_right;
cout<<"Enter Upper Left ";
cin >>upper_left;
cout<<"Enter Upper Right ";
cin >>upper_right ;
cout<<"Enter Lower Left ";
cin>>lower_left ;
cout<<"Enter Lower Right ";
cin>>lower_righ t;
while (upper_left <= lower_left)
{
cout << upper_left <<"," << upper_right <<" ";
upper_left++;
}
[/code]
im not sure where to go from here? How would i move along the other axis.
Im sorry if this isnt clear, i have been up extremely late the past few nights and am running on little sleep. I would appreciate any help or pointers here. Thanks
Comment