c++学习(一)

#include <iostream>
//测试进制的使用
using namespace std;

int main()
{
    int chest = 42;
    int waist = 42;
    int inseam = 42;
    cout<<"Monsier cuts a striking figure!"<<endl;
    cout<<"chest = "<<chest<<" (decimal for 42)"<<endl;
    cout<<hex;
    cout<<"waist ="<<waist<<"(hexadecimal for 42"<<endl;
    cout<<oct; //这句话表示的是这一行以下的全部都是八进制的数
    cout<<"inseam = "<<inseam<<"(octal for 42)"<<endl;
    cout<<endl;
    cout<<inseam<<endl;
    cout<<chest<<endl;
    int a;
    cin>>a;//输入后面不用写>>endl,这样做事不对的
        //输入65输出101,这里说明八进制还在起作用
    cout<<a;
    return 0;
}
</pre><pre name="code" class="html"><pre name="code" class="html">#include <iostream>
//测试转义字符和cout.put()
using namespace std;

int main()
{
 /*   char ch = 'M';
    int i = ch;
    cout<< "The ASCII code for "<<ch<<" is " <<i<<endl;
    //观察加一的效果
    cout<<"Add one to the character code : "<<endl;
    ch = ch + 1;
    i = ch;
    cout<< "The ASCII code for "<<ch<<" is " <<i<<endl;
    //使用cout.put()函数
    cout<<"Displaying char ch using count.put(ch): ";
    cout.put(ch);
    //使用cout.put()显示常量
    cout.put('!');

    cout<<endl;
    */
    //我的测试部分
    char ch1 = 'Z';
    cout<<'Z'<<endl;
    cout<<'$';
    cout<<'0';//这里输出的是相应的字符呀
    cout<<endl;
    cout<<ch1<<endl;
    cout.put('Z');
    cout<<endl<<"Done!\n";
    char alarm = '\a';//计算机响铃
    cout<<alarm<<"Don't di that again!\n";
    cout<<"Ben\"Buggsie\"Hacker\nwas here!\n";


    return 0;
}


 
</pre><pre name="code" class="html"><pre name="code" class="html">#include <iostream>

using namespace std;
//演示输入密码的过程
int main()
{
    cout<<"\a Operation\"HyperHype\"is now actived!\n";
    cout<<"Enter your agent code:________\b\b\b\b\b\b\b\b";
    long code;
    cin>>code;
    cout<<"\aYou entered "<<code<< " ..\n";
    cout<<"\aCode verified Proceed with Plan Z3!\n";
    cout<<endl;
    cout<<"hi \x1  there";//为什么这个there显示不出来?

    return 0;
}

C++笔记(一)
1.什么颜色不伤眼睛?
把Hue(色调设为85,Sat(饱和度)设为90,Lum(亮度)设为205。

 \b是退格符号,可以演示密码的输入过程。3_7
 \a 是要电脑内部响铃。

 


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值