现在软件工程 个人实践作业1:代码管理

1.下载gitbash

2.gitee/github创建仓库

 

3.打开gitbash窗口

 4.按照gitee指示键入命令

 

 

效果: 

 

 gitbas常用命令行

 

 

http://t.csdn.cn/8Gb9j  (3条消息) git pull 报错:error: Pulling is not possible because you have unmerged files._fix them up in the work tree, and then use 'git ad_sylvia_0815的博客-CSDN博客

 完整代码

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
void read_text(FILE *fp)
{
    char line[1024] = {0};
    rewind(fp); // 重置指针
    while (1)
    {
        // 文件读取结束
        if (EOF == fscanf(fp, "%s", line))
            break;
        printf("%s\n", line);
    }
}

int main(int argc, char *argv[])
{
    FILE *fPtr;
    int c; // int 读取单个字符
    int n = 0;
    // printf("%d\n", argc, n);
    printf("---------------------------\n");
    printf("code: %s\n", argv[0]); // wordcount
    printf("mode: %s\n", argv[1]); //-c/w
    printf("name: %s\n", argv[2]); // input file
    fPtr = fopen(argv[2], "r");
    if (fPtr == NULL)
    {
        printf("can't open\n");
    }
    else
    {
        if (argv[1][1] == 'c')
        { // 读字符
            while (c != EOF)
            {
                c = fgetc(fPtr);

                n++;
                // printf("%d %c %d\n", n, c, c);
                // EOF=-1
            }
            printf("n: %d\n", n - 1);
        }
        else if (argv[1][1] == 'w')
        { // 读单词
            int start = 0, end = 0;
            while (c != EOF)
            {

                c = fgetc(fPtr);
                // if (c == 32) //" "
                //     printf("space");
                if (!(c == ' ' || c == ',' || c == '.' || c == '!'))
                {
                    start = 1; // 单词开始
                    // printf("%c s:%d e:%d\n", c, start, end);
                }
                //" "
                else if (c == ' ' || c == ',' || c == '.' || c == '!' || c == '\n')
                {
                    if (start)
                    {
                        end = 1; // 单词结束
                    }

                    // printf("%c s:%d e:%d\n", c, start, end);
                }
                if (start && end)
                {
                    n++;
                    start = end = 0;
                }
            }
            printf("n: %d\n", n);
        }
        printf("---------------------------\nfile content:\n");
        read_text(fPtr);
    }

    printf("---------------------------\n");
    fclose(fPtr);

    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值