c++学习(一)

来源:互联网 发布:制作动漫人物的软件 编辑:程序博客网 时间:2024/06/05 09:48
#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
原创粉丝点击