2016-12-08 91 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