各位大虾速来看看这个很小很小很小的程序
#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
string a;
cin>>a;
int c;
for(int b=0;b<2;++b){
c=2*(b^2);
cout<<a[c]<<endl;}
system("pause");
}
我想要这个程序运行的是:比如我输入sgerhrehrthgdsfse,它程序会输出按照公式c=2*(b^2)时候的取值的字母
但是貌似不对哦
哪呢?
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int b;
int a;
int c=0;
do {
cout<<"输入你猜的数字"<<endl;
cin>>a;
b=a+1;
if(a!=b){
++c;
cout<<"不对啊,继续";
cout<<"已经错误"<<c<<"次啊!加油!"<<endl;
if(c==3){
cout<<"郁闷,3次还不对,这个程序你还相信会成功吗"<<endl; }
if(c==6){
cout<<"日,6次还不对,这个程序是不是假的?嘿嘿,继续不?" <<endl;}
if(c==10){
cout<<"不是吧?10次?假不假?看你自己"<<endl; }
if(c==15){
cout<<"哈哈,白痴,这个程序永远不能猜到"<<endl; }
if(c==16)
{
b=a;
cout<<"不错,你有不甘心的勇气!"<<endl; }
}
}while(a!=b);
cout<<"正确!"<<"猜了"<<c<<"次才猜对!你真笨"<<endl;
system("pause");
}
//本程序, 以后改进的地方:1,怎样让 第15次的时候,自动退出
//2,如何在第15次的时候,不退出并且再第16次输入的时候,能够该改变b的值,让程序输入什么,
// 答案就出现什么,之后再退出
//3,以后改进,变成函数调用==更复杂的,问道五行系统的写法:概率根据名字? 根据上线时间?
//根据本日时间点=====猜想
第二个程序。有点。。。。……,……希望能提供方法。谢谢