跪求C++高手帮忙

来源:百度知道 编辑:UC知道 时间:2024/05/06 08:44:43
我是大2学生,以前C没学号,刚开学老师就出了个题目叫我们做实验,主要是写源代码```搞不懂啊,又要写实验报告,写不出来起码考试估计挂定了,所以请高手帮我写下源代码!~

题目是:从键盘上输入一个整数和一浮点数,比较其大小,并输出小值!~
难道没有高手吗?麻烦回答的大哥大姐些先用visual C++ 6.0运行成功以后再发上来,现在发上来的都是些错的,汗```
最好是麻烦能在程序开头,重要变量,每个函数前面加上注释,谢谢了```
麻烦哪位高人赐教下啊```程序员们都死哪去了啊?

#include<iostream.h>
void main()
{
float a;
int b;
cout<<"Input int"<<endl;
cin>>b;
cout<<"input float"<<endl;
cin>>a;
if(a<b)
cout<<a;
else
cout<<b;
}

#include<iostream>
using namespace std;
int main()
{

float a,b;
int c;
cout<<"输入一个整数和一浮点数:";
cin>>c>>a;
b=c;
cout<<"输出小值:"<<((a>b)?b:a)<<endl;

}

#include "stdio.h"
main()
{int a;
float b;
scanf("%d,%f",&a,&b);
if(a>b)printf("%d",a);
else printf("%f",b);
}