#include <stdlib.h>
int func( int x )
int main( int argc, char *argv[] )
{
int x, y
printf("Please input an integer : ")
scanf("%d", &x)
y = func( x )
printf("The result of call the func function %d\n", y)
return 0
}
int func( int x )
{
if( x <1)
{
return x
}
else if( x >= 10 )
{
return (3*x-1)
}
else
{
return (2*x-1)
}
}
C :int input()
{
int x
printf("input %d",x)
scanf("%d",&x)
return x//x*x)
}
int main()
{
int y
y=input()
printf("input %d",y)
}
Pascal:
program input
var x,y :integer
readln(x)
writeln(x)
y:=x
writeln(y)
end
Basic:
dim x as integer,y as integer
read x
print x,y
end
#include <iostream.h>int main()
{
float iX
cout<<"Please input a value: "
cin>>iX
float iY
if (iX<1){
iY = iX
}else if(iX>=1 && iX<10){
iY = 2*iX-1
}else if (iX >= 10){
iY = 3*iX
}
cout<<"y="<<iY<<endl
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)