2016-12-08 69 views
0

我在visual studio 2015中创建了一个c程序,并且我创建了一个安装文件 安装文件在我的电脑中正常工作。所以我决定发送安装文件给我的朋友,虽然安装文件安装成功,当我们运行该程序它显示系统错误“该程序不能出演,因为VCRUNTIME140D.dll从您的计算机丢失。尝试重新安装节目”从安装文件安装后系统错误

这里是我写的程序(其中工程完美)

#define _CRT_SECURE_NO_DEPRECATE 
#include<stdio.h> 
#include<string.h> 
void beg(); 
void beg2(); 
void beg3(); 
void beg4(); 
void beg5(); 
void beg6(); 
void beg7(); 
void beg8(); 
void beg9(); 
void beg10(); 
void store_a(); 
void the_end(); 
void wrong(); 
void right(); 
void help(); 
int i,m; 
char b[101],a[101]; 
void main() 
{ 
    int diff; 
    i = 0; 
    printf("\n WELCOME THO THE GAME \n"); //welcome 
    printf(" ARE YOU READY !!\n"); 
    do 
    { 
     printf("\n 1.play\t 2.help\t 3.exit\n"); //menu 
     printf(" Enter your option : "); 
     scanf(" %d", &diff); 
     switch (diff) 
     { 
      case 1: 
      { 
       beg(); 
       break; 
      } 
      case 2: 
      { 
       help(); 
       break; 
      } 
      case 3: 
      { 
       break; 
      } 
     } 
    } while (diff != 3); 
} 
void beg() 
{ 
    int b; 
    m = 2; 
    printf("\n what is the capital of india?\n"); 
    printf(" options\n"); 
    printf(" 1.New Delhi\n 2.Mumbai\n 3.Kochi\n 4.Chennai\n"); 
    scanf("%d", &b); 
    if (b == 1) 
    { 
     right(); 
     beg2(); 
    } 
    else 
    { 
     wrong(); 
     beg2(); 
    } 
} 
void beg2() 
{ 
    int b; 
    m = 3; 
    printf("\n 12 + 11 = ?\n"); 
    printf(" options\n"); 
    printf(" 1.12\n 2.45\n 3.23\n 4.17\n"); 
    scanf("%d", &b); 
    if (b != 3) 
    { 
     b = 2; 
     wrong(); 
     beg3(); 
    } 
    else 
    { 
     while (b == 3) 
     { 
      if (b == 3) 
      { 
       right(); 
       beg3(); 
       break; 
      } 
     } 
    } 
} 
void beg3() 
{ 
    int b; 
    m = 4; 
    printf("\n who is the prime minister of india ?\n"); 
    printf(" options\n"); 
    printf(" 1.Pranab Mukherjee\n 2.narendra modi\n 3.manmohan singh\n 4.steven thomas\n"); 
    scanf("%d", &b); 
    if (b != 2) 
    { 
     b = 1; 
     wrong(); 
     beg4(); 
    } 
    else 
    { 
     while (b == 2) 
     { 
      if (b == 2) 
      { 
       right(); 
       beg4(); 
       break; 
      } 
     } 
    } 
} 
void beg4() 
{ 
    int b; 
    m = 5; 
    printf("\n 5 x 7 = ?\n"); 
    printf(" options\n"); 
    printf(" 1.32\n 2.54\n 3.25\n 4.35\n"); 
    scanf("%d", &b); 
    if (b != 4) 
    { 
     b = 1; 
     wrong(); 
     beg5(); 
    } 
    else 
    { 
     while (b == 4) 
     { 
      if (b == 4) 
      { 
       right(); 
       beg5(); 
       break; 
      } 
     } 
    } 
} 
void beg5() 
{ 
    int b; 
    m = 6; 
    printf("\n which country is paris the capital of?\n"); 
    printf(" options\n"); 
    printf(" 1.India\n 2.France\n 3.England\n 4.China\n"); 
    scanf("%d", &b); 
    if (b != 2) 
    { 
     b = 1; 
     wrong(); 
     beg6(); 
    } 
    else 
    { 
     while (b == 2) 
     { 
      if (b == 2) 
      { 
       right(); 
       beg6(); 
       break; 
      } 
     } 
    } 
} 
void beg6() 
{ 
    int b; 
    m = 7; 
    printf("\n what is the capital of america?\n"); 
    printf(" options\n"); 
    printf(" 1.Los Angeles\n 2.New York \n 3.Washington, D.C.\n 4.Las Vegas\n"); 
    scanf("%d", &b); 
    if (b != 3) 
    { 
     b = 1; 
     wrong(); 
     beg7(); 
    } 
    else 
    { 
     while (b == 3) 
     { 
      if (b == 3) 
      { 
       right(); 
       beg7(); 
       break; 
      } 
     } 
    } 
} 
void beg7() 
{ 
    int b; 
    m = 8; 
    printf("\n what is the highest mountain in the world?\n"); 
    printf(" options\n"); 
    printf(" 1.Mount Everest\n 2.Kangchenjunga \n 3.Annapurna\n 4.K2 \n"); 
    scanf("%d", &b); 
    if (b != 1) 
    { 
     b = 3; 
     wrong(); 
     beg8(); 
    } 
    else 
    { 
     while (b == 1) 
     { 
      if (b == 1) 
      { 
       right(); 
       beg8(); 
       break; 
      } 
     } 
    } 
} 
void beg8() 
{ 
    int b; 
    m = 9; 
    printf("\n who invented piano?\n"); 
    printf(" options\n"); 
    printf(" 1.serin thomas\n 2.Bartolomeo Cristofori \n 3.annrose pino\n 4.Baldwin pinero \n"); 
    scanf("%d", &b); 
    if (b != 2) 
    { 
     b = 3; 
     wrong(); 
     beg9(); 
    } 
    else 
    { 
     while (b == 2) 
     { 
      if (b == 2) 
      { 
       right(); 
       beg9(); 
       break; 
      } 
     } 
    } 
} 
void beg9() 
{ 
    int b; 
    m = 10; 
    printf("\n what is the answer of (3-3 x 6+2)?\n"); 
    printf(" options\n"); 
    printf(" 1.-17\n 2. 0 \n 3. -13\n 4. 9 \n"); 
    scanf("%d", &b); 
    if (b != 3) 
    { 
     b = 1; 
     printf("\n Do you want to know the correct answer for the qustion :\n1.yes\n2.no\t: "); 
     scanf("%d", &opt); 
     if (opt == 1) 
     { 
      printf("\n The correct answer is as follows:\n Question: 3 – 3 x 6 + 2\n Multiplication first : 3 – 18 + 2\n Left to right : -15 + 2\n Answer : -13\n"); 
     } 
     wrong(); 
     beg10(); 
    } 
    else 
    { 
     while (b == 3) 
     { 
      if (b == 3) 
      { 
       right(); 
       beg10(); 
       break; 
      } 
     } 
    } 
} 
void beg10() 
{ 
    int len,i,f; 
    store_a(); 
    printf("\n A man has a barrel with filled with oil that weighs 100 pounds,\n and then he puts something into it.\n Now the barrel weighs less than 100 pounds.\n What did he put in the barrel ?? \n"); 
    printf(" enter the answer :"); 
    scanf("%s", b); 
    len = strlen(b); 
    for (i = 0; i < len; i++) 
    { 
     if (a[i] == b[i]) 
     { 
      f = 1; 
     } 
     else 
     { 
      f = 0; 
      break; 
     } 
    } 
    if (f == 1) 
    { 
     printf("The answer is correct!!\n"); 
     the_end(); 
    } 
    else 
    { 
     printf(" Wrong answer\nthe correct ans was 'hole'\n"); 
     the_end(); 
    } 

} 
void wrong() 
{ 
    printf("wrong answer !!\n"); 
    printf("your score is :%d\n", i); 
    printf("\n qustion number: %d", m); 
}//when the option is wrong 
void the_end() 
{ 
    printf("\n***congratulations***\n"); 
    printf(" your final score is :%d\n", i); 
}//at the end of the game 
void right() 
{ 
    printf("the answer is correct !!\n"); 
    i++; 
    printf("your score is :%d\n", i); 
    printf("\n qustion number: %d", m); 
}//when the ans is correct 
void help() 
{ 
    int opt; 
    printf("\n 1.How to play\t2.About\t3.Main menu\n"); 
    printf(" enter your option : "); 
    scanf("%d", &opt); 
    if (opt == 1) 
    { 
     printf(" answer the qustions..\n you get 1 point for each qustion..\n there is a total of 10 qustions try to get the maximum marks\n good luck \n"); 
     help(); 
    } 
    else if (opt == 2) 
    { 
     printf("\tCREATED BY\n **STEVEN THOMAS** \n **[email protected]**\n "); 
     help(); 
    } 
    else if (opt == 3) 
    { 
     main(); 
    } 
}//help menu 
void store_a() 
{ 
    a[0] = 'h'; 
    a[1] = 'o'; 
    a[2] = 'l'; 
    a[3] = 'e'; 
} 

,这是我创建 click here to download

请告诉我什么是错在这里

安装文件

回答

2

您已经构建并发布了程序的调试版本。调试VC运行时不是VC可再发行组件包的一部分,因此您的朋友会收到有关缺少DLL的消息。构建和发布版本。

+0

kk感谢您的回复,让我看看它是否可行 –

+0

我创建了我的程序发行版的安装文件,现在我应该共享哪些文件以便在不同的PC上工作 –

+0

只有您的项目可执行文件和dll。您还可能包含VC运行时可再发行组件(它可在Microsoft网站上获得所有VS版本)。 – Ari0nhh