Jump to content
LegendKiller

Problema c++

Recommended Posts

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.

Link to comment
Share on other sites

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;
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...