i have some code about the Hanoi Tower here

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void cthap(int m,int x1,int y1,int x2,int y2,int x3,int y3)
{
    if(m<1)
        return;
    else
        if(m==1)
            printf("\nchuyen tang 1 tu (%d,%d) tới (%d,%d) ",m,x1,y1,x2,y2);
        else
            {
                cthap(m-1,x1,y1-1,x2,y2,x3,y3);
                printf("\nchuyen tang %d (%d %d) toi tang (%d %d)",m,x1,y1,x2,y2);
                cthap(m-1,x3,y3,x2,y2-1,x1,y1);
            }
}
void main(int argc,char *argv[])
{
    int m,x1,x2,x3,y1,y2,y3;
    if(argc==8)
    {    m = atoi(argv[1]);
         x1= atoi(argv[2]);
         y1= atoi(argv[3]);
         x2= atoi(argv[4]);
         x3= atoi(argv[6]);
         y2= atoi(argv[5]);
         y3= atoi(argv[7]);
        cthap(m,x1,y1,x2,y2,x3,y3);
    }
    else
        printf("tham so dong lenh sai \n");
    getch();

}

when i debug i used properties and then debugging to insert the current number and the code run well but when i use MS DOS it just said that "The system cannot find the path specified." why? i confused

It may be that your compiler doesn't recognize the point of entry indicated by void main(). Try int main() instead. In the past some compilers allowed main() to be declared with return type void, but it was a proprietary extension and not all compilers let you do it that way.

Likewise using printf() in C++ is not illegal there is usually no practical point to do so. Using cout is the usual approach.

should be a pratice to always use int main(). Main in cpp is not void.
With your args, i think you are not entering it right or some other stuff you are not doing it right.

It sounds to me that:

"The system cannot find the path specified."

means that you have an MSDOS window, but you are not in the directory where the program is. You need to find the EXE created from your program and move your DOS window to there with CD commands at the command line.

I doubt it has anything to do with he internals of your program.

This article has been dead for over six months. Start a new discussion instead.