注释转换<C注释-->C++注释>

# 本篇博客为简单的注释转换实现,功能为将简单的C注释段落转换为CPP注释



@ 注意: 代码中所用到的fopen,fwrite,fread等文件操作函数在通讯录文件流博客中做了介


@ ungetc 函数是将从文件中读取的一个字符还回到缓冲区,即文件中去;

@ 分析思路图

@分析思路图

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#include <iostream> #include <ctime> using namespace std; struct userNode { int key; bool sex; int birthday; struct userNode *next = NULL; }; userNode *HashTable[288]; int Hash(int key) { int res = 0; while (key) { res += key % 100; key /= 100; } return res - 10; } userNode *Login(int key) { int afterHash = Hash(key); userNode *p = HashTable[afterHash]; while (p && p->key != key) { p = p->next; } if (p && (p->key == key)) { return p; } else { return NULL; } return NULL; } int Register(userNode *newUser) { int afterHash = Hash(newUser->key); // userNode p = HashTable[afterHash]; // while (p) // { // p = p->next; // } newUser->next = HashTable[afterHash]; HashTable[afterHash] = newUser; return 0; } int main() { userNode nowTmp; int tmp; while (1) { system("cls"); cout << "请输入你的PP号:" << endl; tmp=0; while (tmp<100000 || tmp>999999) { cin >> tmp; } nowTmp = Login(tmp); if (nowTmp) { system("cls"); cout << "-------------------------------------------" << endl << "| 登录成功! |" << endl << "| PP号:" << nowTmp->key << " |" << endl << "| 性别:" << (nowTmp->sex ? "男" : "女") << " |" << endl << "| 生日:" << nowTmp->birthday << " |" << endl << "-------------------------------------------" << endl; system("pause"); } else { // 自动注册 srand(time(0)); nowTmp = new userNode; nowTmp->key=tmp; nowTmp->birthday= 2002 + rand() % 21; nowTmp->birthday=100; nowTmp->birthday+= 1 + rand() % 12; nowTmp->birthday=100; nowTmp->birthday+= 1 + rand() % 28; nowTmp->sex= rand() % 2; Register(nowTmp); cout << "这个PP号还没注册!帮你注册了!请重新登录!" << endl; system("pause"); } } //散列情况展示部分 // int a[288]; // for (int i = 0; i <= 287; i++) // { // a[i]=0; // } // for (int i = 100000; i <= 999999; i++) // { // a[Hash(i)]++; // } // for (int i = 0; i <= 287; i++) // { // cout<<"a["<<i<<"]="<<a[i]<<endl; // } return 0; }写注释
06-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值