skylerma

C#与C++的对比

[align=center] [size=5][color=#ff0000]C#与C++的对比[/color][/size][/align]
今天我用C++和C#同时写了计算长方体的体积 同时也反应了C++与C#的区别
[color=#00ffff]C#
Console.WriteLine("by skyler qq206268322");
Console.WriteLine("请输入长方形的长:");
int Length = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入长方形的宽:");
int Width = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入长方形的高:");
int Height = Convert.ToInt32(Console.ReadLine());
int S = Length * Width * Height;
Console.WriteLine("长方形的体积为:{0}", S);
Console.ReadKey();[/color]

[attach]476064[/attach][attach]476065[/attach]
[color=#00ff00]C++的代码
#include <stdio.h>

int V(int Length,int Width,int Height);
int main()
{
int m_length,m_width,m_height,result,qq;
printf ("by skyler QQ206268322\n");
printf("请输入长方体的长:\n");
scanf("%d",&m_length);
printf("请输入长方体的宽:\n");
scanf("%d",&m_width);
printf("请输入长方体的高:\n");
scanf("%d",&m_height);
result=V(m_length,m_width,m_height);
printf("长方形的体积为:\n");
printf("%d\n",result);
printf ("by skyler QQ206268322");
scanf("%d",qq);
return 0;
}
int V(int Length,int Width,int Height)
{
int result;
result=LengthWidthHeight;
return result;
}[/color][attach]476066[/attach][attach]476067[/attach]

查看回复
0%
粤ICP备18082987号-1 浙公网安备 33010902001746号
友情链接:
喵宅苑
喵空间社区程序
络合兔
技术宅
腕能新趣
小五四博客
莉可POI
Mithril.js
枫の主题社
Project1
午后少年
机智库
七濑胡桃
xiuno
幻想の博客