c++ - Enter two integer and display the largest number using predefined function -
i type function can't output. can me. must use predefined function. program running have errors please me.
#include <iostream> using namespace std; float largenum (float a, float b) { float largenum; if(a>b) cout<<"a larger"; if(b>a) cout<<"b larger"; return (largenum); } int main() { float num1, num2; cout<<"enter number"; cin>>num1; cout<<"enter number"; cin>>num2; cout<<largenum<< "is larger"<<endl; return 0; }
#include <iostream> using namespace std; float largenum (float a, float b) { if(a>b) return a; return b; } int main() { float num1, num2; cout<<"enter number"; cin>>num1; cout<<"enter number"; cin>>num2; cout<<largenum(num1, num2)<< "is larger"<<endl; return 0; }
Comments
Post a Comment