Jump to content
Fórum Script Brasil
  • 0

ABRIR ARQUIVOS EM C


athoslive

Question

3 answers to this question

Recommended Posts

  • 0

#include <stdio.h>

#include <windows.h>

int fatorial(int valor)

{

if (valor == 1)

return(1);

else

return(valor * fatorial(valor-1));

}

int main(void)

{

int i;

for (i = 1; i <= 5; i++)

printf("O fatorial de %d ‚ %d\n", i, fatorial(i));

system("main.exe");// qualquer programa

}

Edited by roccoC/C++
Link to comment
Share on other sites

  • 0

bom,

na verdade você pode usar a função SYSTEM() para enviar linhas de comando como se estivesse dentro do promt de comando ( CMD ).

Ou seja.

Supondo que seu programa se chame "algo.exe" e esteja no mesmo diretório do nosso exe basta digitar

#include <stdlib.h>

int main()

{

system("algo.exe");

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...