#include <iostream>
using namespace std;
int test(int a, int b, int c) {
return a > (b > c ? b : c) ? a : (b > c ? b : c);
}
int main() {
std::cout << test(3, 4, 5) << std::endl;
return 0;
}
Kod:
#include <iostream>
int test(int a, int b, int c) {
return std::max(a, std::max(b, c));
}
int main() {
std::cout << test(3, 4, 5) << std::endl;
return 0;
}
This program takes n number of element from user (where, n is specified by user) and stores data in an array. Then, this program displays the largest element of that array using loops.
Fonksiyon içerisinde en yüksek sayıyı kayıt edeceğin bir değişken oluşturup X değerini ata sonrasında Y ve Z değerlerini bu değişkene göre kıyaslayabilirsin.
#include <iostream>
using namespace std;
int test(int a, int b, int c) {
return a > (b > c ? b : c) ? a : (b > c ? b : c);
}
int main() {
std::cout << test(3, 4, 5) << std::endl;
return 0;
}
Kod:
#include <iostream>
int test(int a, int b, int c) {
return std::max(a, std::max(b, c));
}
int main() {
std::cout << test(3, 4, 5) << std::endl;
return 0;
}
#include <iostream>
using namespace std;
int test(int a, int b, int c) {
return a > (b > c ? b : c) ? a : (b > c ? b : c);
}
int main() {
std::cout << test(3, 4, 5) << std::endl;
return 0;
}
Kod:
#include <iostream>
int test(int a, int b, int c) {
return std::max(a, std::max(b, c));
}
int main() {
std::cout << test(3, 4, 5) << std::endl;
return 0;
}
#include <iostream>
using namespace std;
int test(int a, int b, int c) {
return a > (b > c ? b : c) ? a : (b > c ? b : c);
}
int main() {
std::cout << test(3, 4, 5) << std::endl;
return 0;
}
Kod:
#include <iostream>
int test(int a, int b, int c) {
return std::max(a, std::max(b, c));
}
int main() {
std::cout << test(3, 4, 5) << std::endl;
return 0;
}