|
发表于 2018-8-9 13:58:05
|
显示全部楼层
本帖最后由 AastaLee 于 2018-8-9 15:03 编辑
0. 只懂二進制的0和1
1. 機器語言
2. 編譯
3. 編譯型語言做出來的機器瑪可以直接被CPU執行 解釋型語言寫出來的字節碼需要被解釋氣解釋後才能被CPU執行
4. 否
5.
6.
7.翻譯出來了看不懂...
一直顯示總共寫了7行代碼
- #include <io.h>
- #include <direct.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define MAX 256
- long total;
- int countLince(const char *filename);
- void findAllCodes(const char *path);
- void findALLFiles(const char *path);
- int countLines(const char *filename)
- {
- FILE *fp;
- int count = 0;
- int temp;
-
- if((fp = fopen(filename, "r")) == NULL)
- {
- fprintf(stderr, "Can not open the file:%s\n", filename);
- return 0;
- }
-
- while (( temp = fgetc(fp)) != EOF)
- {
- if (temp == '\n')
- {
- count++;
- }
- }
-
- fclose(fp);
-
- return count;
- }
- void findAllCodes(const char *path)
- {
- struct _finddata_t fa;
- long handle;
- char thePath[MAX], target[MAX];
-
- strcpy(thePath, path);
- if((handle = _findfirst(strcat(thePath, "/*.c"), &fa)) != -1L)
- {
- do
- {
- sprintf(target, "%s/%s", path, fa.name);
- total += countLines(target);
- }while (_findnext(handle, &fa) == 0);
- }
-
- _findclose(handle);
- }
- void findALLDirs(const char *path)
- {
- struct _finddata_t fa;
- long handle;
- char thePath[MAX];
-
- strcpy(thePath, path);
- if((handle = _findfirst(strcat(thePath, "/*"), &fa)) == -1L)
- {
- fprintf(stderr, "The path %s is wrong!\n", path);
- return;
- }
-
- do
- {
- if (!strcmp(fa.name,".") || !strcmp(fa.name, ".."))
- continue;
-
- if(fa.attrib == _A_SUBDIR)
- {
- sprintf(thePath, "%s/%s", path, fa.name);
- findAllCodes(thePath);
- findALLDirs(thePath);
- }
- }while(_findnext(handle, &fa) == 0);
-
- _findclose(handle);
- }
- int main()
- {
- char path[MAX] = ".";
-
- printf("計算中...\n");
-
- findAllCodes(path);
- findALLDirs(path);
-
- printf("目前你總共寫了 %1d 行代碼!\n\n", total);
- system("pause");
-
- return 0;
- }
复制代码 |
|