LegendKiller Posted February 11, 2010 Report Share Posted February 11, 2010 Am pt scoala , o problema , care suna in felul urmator : Se citesc patru numere intregi de la tastatura : a,b,c,d . Determinati care dintre produsele a*b si c*d este mai mare .Momentan eu am facut pana aici .#include <iostream>using namespace std;int main(){ long int a,b,c,d,max; cout<<"a="; cin>>a; cout<<"b="; cin>>b; cout<<"c="; cin>>c; cout<<"d="; cin>>d; max=0; if((a*>(c*d)) {cout<<"a*b este mai mare decat c*d"; else cout<<"c*d este mai mare decat a*b"; } return 0;}Imi da eroare si nu stiu de ce . Programul a fost facut in CodeBlocks. Quote Link to comment Share on other sites More sharing options...
Nytro Posted February 11, 2010 Report Share Posted February 11, 2010 if((a*>(c*d)) cout<<"a*b este mai mare decat c*d";else cout<<"c*d este mai mare decat a*b"; Quote Link to comment Share on other sites More sharing options...
cmiN Posted February 11, 2010 Report Share Posted February 11, 2010 Ai inclus else-ul in blocul de instructiuni al if-ului, fiecare are propriul bloc cuprins in cate o pereche de paranteze.#include <iostream>using namespace std;int main(){ unsigned long a, b, c, d; cout << "a="; cin >> a; cout << "b="; cin >> b; cout << "c="; cin >> c; cout << "d="; cin >> d; if ((a * > (c * d)) { cout << "a*b=" << a * b << " mai mare decat c*d=" << c * d; } else { cout << "c*d=" << c * d << " mai mare decat a*b=" << a * b; } system("pause >NUL"); return 0;} Quote Link to comment Share on other sites More sharing options...
SENEQ_o Posted February 11, 2010 Report Share Posted February 11, 2010 #include <iostream.h>int a,b,c,d;int main(){ cin >>a>>b>>c>>d; if(a*b > c*d) cout << "a*b mai mare decat c*d"; else cout << "c*d mai mare decat a*b";}return 0;Folosesti Mingv studios in loc de CodeBlocks. e mult mai simplu... Quote Link to comment Share on other sites More sharing options...
LegendKiller Posted February 11, 2010 Author Report Share Posted February 11, 2010 Multumesc mult . Quote Link to comment Share on other sites More sharing options...