- Код: Выделить всё
#include<iostream>
#include <conio.h>
using namespace std;
int main()
{
char ch;
char gh;
while(ch!='\r')
{
cout<<"vvedite signal datchika horizont (1/0)\2\n";
while(ch!='0')
{
ch=getche();
if(ch=='1')
cout<<"\nPovorot v pravo na 0.01s\n";
else
cout<<"\nPovorot v levo na 0.1s\n";
}
ch++;
while(gh!='0')
{
gh=getche();
if(gh=='1')
cout<<"\nPovorot v levo na 0.01s\n";
else
cout<<"\nPovorot v praqvo na 0.1s\n";
}
gh++;
}
return 0;
}
вот продолжение кода
- Код: Выделить всё
include<iostream>
#include <conio.h>
using namespace std;
int main()
{
int rh;
int lh;
int rv;
int lv;
while(rh!='\r')
{
cout<<"vvedite signal datchika horizont (1/2) i datchika vertikal (3/4) \2\n";
while(rh!='2' && rv!='4')
{
rh=getche();
rv=getche();
if(rh=='1' && rv=='3')
cout<<"\nPovorot v pravo na 0.01s, Povorot vniz na 0.01s\n";
else
if(rv=='3')
cout<<"\nPovorot vniz na 0.01s\n";
else
if(rh=='1')
cout<<"\nPovorot v pravo na 0.01s\n";
else
cout<<"\nPovorot v levo na 0.1s, Povorot vverh na 0.01s\n";
}
rh++; rv++;
while(lh!='2' && lv!='4')
{
lh=getche();
lv=getche();
if(lh=='1' && lv=='3')
cout<<"\nPovorot v levo na 0.01s, Povorot vverh na 0.01s\n";
else
if(lv=='3')
cout<<"\nPovorot vverh na 0.01s\n";
else
if(lh=='1')
cout<<"\nPovorot v levo na 0.01s\n";
else
cout<<"\nPovorot v pravo na 0.1s, Povorot vniz na 0.01s\n";
}
lh++; lv++;
}
return 0;
}