cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
I want to move this triangle using arrow
I want to move this triangle using arrow keys but the triangle shape is not comming please help me
May 19, 2013 at 7:20am UTC
dgcharitha
(20)
#include<iostream>
#include<ncurses.h>
//#include<iostream>
using namespace std;
void triangle();
int main()
{
int ch;
int x;
x=20;
initscr();
keypad(stdscr,TRUE);
noecho();
move(5,x);
triangle();
ch =getch();
while(ch !='q')
{
if(ch==KEY_LEFT)
x=x-1;
else if(ch==KEY_RIGHT)
x=x+1;
move(5,x);
triangle();
ch=getch();
}
endwin();
return 0;
}
void triangle()
{
for(int i=0;i<4;i++)
{
for(int j=0;j<i;j++)
cout<<"*";
cout<<endl;
}
}
May 19, 2013 at 7:33am UTC
MiiNiPaa
(8886)
I do not see any use of x in your triangle function.
Topic archived. No new replies allowed.