|
For your next assignment, extend your program to work in three dimensions and use OpenGL to display the balls. For bonus credit, display the bounding cube with translucent walls. In other words, partially transparent but not totally.
Good luck.
|
|
|
|
|
2 errors is coming can anyone help me
|
|
|
|
|
Here are some possibilities: LMGTFY[^]
<sig notetoself="think of a better signature">
<first>Jim</first> <last>Meadors</last>
</sig>
|
|
|
|
|
nithiin_sai wrote: 2 errors is coming can anyone help me
Maybe...
But only if you'll show your code and exact error messages.
|
|
|
|
|
It could be worse, it could be raining.
|
|
|
|
|
nithiin_sai wrote: ...can anyone help me
At this point, no.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
You should post the question in the forum at the end of the article, so the person who created the code can answer.
|
|
|
|
|
|
Thank you ! This could be a good track to follow ... until then, I am facing to far more easy problem:
How To Hide A Window in TaskBar[^]
modified 18-Jan-18 7:31am.
|
|
|
|
|
The rules for that are spelled out in detail from Microsoft
The Taskbar[^]
SetWindowLong(yourHWND, GWL_EXSTYLE, GetWindowLong(yourHWND, GWL_EXSTYLE) & ~(WS_EX_APPWINDOW | WS_EX_TOOLWINDOW));
Straight after you create the window grab the handle and change the style flags and it will stop it being displayed.
In vino veritas
|
|
|
|
|
It is easy and can be easily solved by just reading the article:
typedef ITaskbarList *LPITaskbarList
|
|
|
|
|
I have tried this the below code but the compiler is showing logic error. I am unable to find my error.
And please tell me what is the right logic.
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
int find(int name);
int check(int temp[], int i);
void del(int name);
int repetetion(int temp[] , int name);
int indexing(int temp[]);
int m[3], r[3], l[3];
int mp=0, rp=0, lp=3 ;
int main()
{
int i=0;
int temp=1, name;
char position, answer;
while(i < 4)
{
l[i] = 4-i;
m[i] = 0;
r[i] = 0;
}
printf("\nWelcome to the towers of hanoi. . . \n\n");
while((r[0] != 4 && r[1] != 3 && r[2] != 2 && r[3] != 1) && toupper(answer) == 'Y')
{
printf("\nEnter the block name:\n");
scanf("%d", &name);
find(name);
while(find(name) == 1){
printf("This block cannot be moved! Please chose again. . .\n");
scanf("%d", &name);
find(name);
}
printf("\n\nEnter the position you want to move it in..\n");
scanf("%1s", &position);
while(temp=1)
{
if(toupper(position)=='M'){
if(find(name)==0 && (temp=repetetion(m, name))==0){ del(name); m[mp] = name; mp++; continue;
}
}
else if(toupper(position) == 'L'){
if(find(name)==0 && (temp =repetetion(l, name))==0){
del(name);
l[lp] = name;
lp++;
continue;
}
}
else if(toupper(position) == 'R'){
if(find(name)==0 && (temp = repetetion(r, name))==0){
del(name);
r[rp] = name;
rp++;
continue;
}
}
printf("Invalid entry! Please enter again. . ."); scanf("%1s", &position);
}
if( r[0] == 4 && r[1] == 3 && r[2] == 2 && r[3] == 1)
{
printf("\n\nYou have solved the HANOI TOWER PUZZLE. . .");
printf("\n\nWant to play again? (Y/N) ");
scanf("%1s", &answer);
}
}
printf("\t\tTHANK YOU !");
return 0;
}
int find(int name)
{
int i, temp;
for(i=0; i<4; i++)
{
if(m[i]==name){
temp = check(m, i); }
else if(l[i]==name){
temp = check(l, i);
}
else if(r[i]==name){
temp = check(r, i);
}
}
return (temp);
}
int check(int temp[], int i)
{
if(i != indexing(temp))
return(1) ;
else if(i == indexing(temp))
return(0) ;
}
int indexing(int temp[])
{
int count=0;
while(temp[count]!= 0)
{
count++;
}
return(count) ;
}
int repetetion(int temp[] , int name)
{
int i, flag;
for(i=0; i<4; i++)
{
if(temp[i] == name)
{
flag = 1;
break;
}
else
{
flag = 0;
}
}
return(flag);
}
void del(int name)
{
int i;
for(i=0; i<4; i++)
{
if(m[i]==name){
m[i] = 0;
mp--;
}
else if(l[i]==name){
l[i] = 0;
lp--;
}
else if(r[i]==name){
r[i] = 0;
rp--;
}
}
return ;
}
Thank you
|
|
|
|
|
If you got compiler errors and warnings, inspect them or add them to your question so that we know them. They contain the line number where the error occured. Inspect that line and the previous one(s) (some errors are sourced on previous lines and detected later). Read the error message. If you do not understand them, do some web research first.
However, there is one big beginner's mistake in your code:
The size of the arrays and the access to the array elements. With C/C++, arrays are accessed by zero based indexes. So the allowed indexes for a size of three are 0, 1, and 2. But your code uses also the index 3. As a result, your code will never work as expected or even crash.
So change the array sizes to
int m[4], r[4], l[4]; before handling any other errors.
|
|
|
|
|
the compiler just keeps on running , i.e. just the cursor appears and nothing else
|
|
|
|
|
That is not the compiler, but your program when executed after compiling.
The solution to that problem is provided below by Richard.
But my answer is still valid and important. And there might be more errors.
|
|
|
|
|
while(i < 4)
{
l[i] = 4-i;
m[i] = 0;
r[i] = 0;
}
You never increment variable i so this loop will run for ever.
|
|
|
|
|
|
Tarun Jha wrote: ...the compiler is showing logic error. Highly unlikely. If anything, it is showing you syntax errors (e.g., endless loop).
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
OP doesn't understand what is happening. The code compiles OK, it's the execution that fails.
|
|
|
|
|
How to sort digits of a number?. Can we use bubble sort? If so, how to use values inside for loop?
|
|
|
|
|
Quote: How to sort digits of a number? There are several way to do that. A simple approach could be convert the number to a string and then sort the string characters.
Quote: Can we use bubble sort? Of course. Anyway, you know, bubble sort is inefficient. However that strongly depends on the size of the input (in your case, I assume the size of the input very small).
Quote: If so, how to use values inside for loop?
Quote Selected Text What do you mean?
|
|
|
|
|
|
I am writing a C program to convert input value to hours minutes.
eg :
input : 126, output : 2 : 6, input : 45 , output : 0 : 45.
For values like 3663, its printing
61 : 3
1 : 1
instead of 61 : 3.
My logic is :
int t1,t2,r=0,n,t;
printf("Enter time\n");
scanf("%d",&t1);
while(t1>0){
printf("%d\n",t1);
if(t1<60){
break;
}
t=t1%60;
r=r+t;
t1=t1/60;
printf("%d : %d\n",t1,t);
}
What is wrong here?
|
|
|
|
|
It is your while loop that checks t1 which gets the number of hours assigned in the loop. With input 3663, t1 is set to 63 within the first loop iteration which is then processed and shown as "1:1".
Add the missing scanf() call at the end of the loop to read the next user input and remove the unnecessary lines:
scanf("%d", &t1);
while (t1 > 0){
printf("%d\n", t1);
t = t1 % 60;
t1 = t1 / 60;
printf("%d : %d\n", t1, t);
scanf("%d", &t1);
}
|
|
|
|