This C++ code is developed for direction, User enters two integer values from keyboard and conditional statements check it while the numbers lies in which direction.
#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int num1, num2;
cout<<"\nEnter 1st integer: ";
cin>>num1;
cout<<"\nEnter 2nd integer: ";
cin>>num2;
if(num1 >=1 && num1 <=8)
cout<<"\nThe point lies in north region and value is "<<num1;
else if(num2 >=9 && num2 <=16)
cout<<"\nThe point lies in north region and value is "<<num2;
else if(num1 >=17 && num1 <=24)
cout<<"\nThe point lies in north region and value is ";
else if(num2 >=25 && num2 <=32)
cout<<"\nThe point lies in north region and value is ";
else
cout<<"\nInvalid option!";
getch();
}
0 comments:
Post a Comment