网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
05月30日漏签0天
c++吧 关注:616,940贴子:2,111,032
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 3回复贴,共1页
<<返回c++吧
>0< 加载中...

来个大佬帮忙看看程序

  • 只看楼主
  • 收藏

  • 回复
  • OooopsLuo
  • ,
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
编写的一个字符加密程序,但是不知道为什么运行时跳过了一段cout输出
代码:
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
int main(int argc, char** argv)
{
begin:
cout << "Enter password to start this encryption program" << endl;
string Password = "A123C";
string password;
cin >> password;
if(password == Password)
cout << "Password CORRECT" << endl << endl;
else
{
cout << "ERROE, please enter again " << endl <<endl;
Sleep(1000);
goto begin;
}
cout << "Starting the encryption program "
<< "[ ]"
<< "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
for(int v;v<20;v++)
{
cout << "#";
Sleep(200);
}
cout << "\r"
<< "Program loading is completed " << endl
<< "---------------------------------------------------" << endl
<< "Enter the code you want to encrypt: ";
char a[100];
cin.get();
cin.getline(a,100);
==============运行时没有输出这一段===============
cout << "Encrypting, please wait "
<< "[ ]"
<< "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
for(int v;v<20;v++)
{
cout << "#";
Sleep(200);
}
======================================================
cout << "\r"
<< " "
<< "\nCode encrypting is completed" << endl
<< "Encrypted code is: ";
从这往下的是加密算法,不看也没关系
int i=0;
char c;
start:
c = int(int(a[i])+4), i++;
cout << c;
if(a[i] == '\0')
goto end;
c = int(int(a[i])+9), i++;
cout << c;
if(a[i] == '\0')
goto end;
c = int(int(a[i])+6), i++;
cout << c;
if(a[i] == '\0')
goto end;
c = int(int(a[i])+2), i++;
cout << c;
if(a[i] == '\0')
goto end;
c = int(int(a[i])+8), i++;
cout << c;
if(a[i] == '\0')
goto end;
c = int(int(a[i])+7), i++;
cout << c;
if(a[i] == '\0')
goto end;
c = int(int(a[i])+3), i++;
cout << c;
if(a[i] == '\0')
goto end;
else
goto start;
end:
cout << endl;
return 0;
}


  • OooopsLuo
  • ,
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
别问我为什么要输出一堆奇奇怪怪的东西
因为这破程序不是我写的······


2025-05-30 07:51:46
广告
  • 荃蕙思萌
  • ,
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
不显示,怕是无限循环了吧。 用goto 又到了bigen 哪里了把。
后面没运行吧。。


  • 火柴人天秤
  • <<
    12
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
goto会让程序的逻辑极其混乱,


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 3回复贴,共1页
<<返回c++吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示