C Language FAQs Summary

Source: Internet
Author: User

1. Run the program multiple times

Workaround:
The reason for the error is that the compiler has run out an EXE, did not close this exe, and click Compile run.
You should close the EXE that you ran before, and then run the code

2, single-precision type and double-precision type How to distinguish the use ...
Workaround:
The difference between single-and double-precision is the exact number of digits after the decimal point. and double precision is called double type, single-precision float type.

3. Initialization and definition of string array
Error occurred:

Error code:

Workaround:
Use the strcpy function when assigning values.

4, the program does not write the main function main
Error occurred:

Workaround:
Missing main function Main, program cannot execute.
In the book (C Language Project Introduction) in 1.5.4, referred to the addition of the main function
Next Enter main function main, detailed code is as follows:
01/*
main function
03 */
int main ()
05 {
Title (); Title on the Welcome screen
07}

5, a+=a*=a/=a-6 This order how to solve Ah, for full layout sub-order
Error occurred:

Workaround:
The third one is wrong, when a equals 4,4x4 is 16. 16+16 equals 32.

6. The CMenu class is not found in the Class wizard
VC + + Introduction to master the eighth chapter instance 8.3--menu bar with icon
Error occurred:
There is a requirement to define a custom class that inherits from the CMenu class, I cannot find the CMenu class in the Class Wizard, I have manually added it, the class is defined, but it is not the class I defined in the Class wizard
Workaround:
Inserting classes directly without using the Class wizard

7. Incorrect format of input statement
Run result error

Workaround:
SCANF format error for input statement

Remove parentheses in double quotation marks
8. How to understand the example code of the teacher's candy

#iclude <stdio.h>#include <stdlib.h>int main(){    int m;//    int x=1;    for(m==3;;m++)    {            if(((m-1)*m+(m*m)/9==m*m)&&m%3==0)            {                break;            }    }    printf("学生人数为:%d人\n",m);    printf("老师将糖果分成了:%d份\n",m*m);    return 0;}


What's going on
Workaround:
There are at least 11 sweets, and you can have one-tenth after a share.

9, integer variables and symbolic constants similar?
Workaround:
One is a variable, one is a constant, and the other is different.

10, how to set the conditions of the exit cycle?

Workaround:
When name is 0, the while loop exits
11, can not run the "C language from the beginning to master the third edition" instance 3.12 code.

Workaround:
First open the extern1.c file, and then in the open file with Ctrl+o Open the extern2.c file, and then compile the extern2.c file, and then compile and run the extern1.c file
12. You cannot open a code file to write.

Workaround
Software incompatibility issues, incompatible with Office, 2 solutions
(1) Download Repair Tool Filetool
(2) Uninstall Office installation WPS, and then run as Administrator
13. After writing the code, the running result is not a number

Workaround:
The% number is abbreviated. Remove a%.
14. Error writing code

Workaround:
The printf () function uses the Chinese symbol and changes the symbol to the English symbol.
15. What's wrong with the code?

Workaround:
(1) header file stdio.h before the space is removed
(2) The last printf function wrote one less before HN,
16. What's wrong with the program?

Workaround:
The SCANF () function did not write &.

C Language FAQs Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.