0% found this document useful (0 votes)
64 views2 pages

#Include Using Namespace Enum

The document defines an enum to represent different car company brands as integer values. It then prompts the user to input a number to select a brand, uses a switch statement to output the corresponding brand name. It also defines a struct with double and int data types to store expression values, takes user input for x and n, calculates a sum in a for loop, and outputs the final z value of the expression.

Uploaded by

edin zulji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views2 pages

#Include Using Namespace Enum

The document defines an enum to represent different car company brands as integer values. It then prompts the user to input a number to select a brand, uses a switch statement to output the corresponding brand name. It also defines a struct with double and int data types to store expression values, takes user input for x and n, calculates a sum in a for loop, and outputs the final z value of the expression.

Uploaded by

edin zulji
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

#include<iostream>
using namespace std;
enum e_acomany
{ Audi=4,
BMW=5,
Cadillac=11,
Ford=44,
Jaguar=45,
Lexus=46,
Maybach=55,
RollsRoyce=65,
Saab=111
};
int main ()
{
e_acomany model;
int n;
cout<<"Da bi ste dobili automibil upisite jedan od ponudjenih brojeva"<<endl
<<"4 5 11 45 46 55 65 111"<<endl;
cout<<"Upisite broj:";
cin>> n;
cout<<"Izabrali ste automobil:"<<n<<endl;
switch (n)
{
case 4: model=Audi; cout<<"Audi"; break;
case 5: model=BMW; cout<<"BMW"; break;
case 11: model=Cadillac; cout<<"Cadillac"; break;
case 44: model=Ford; cout<<"Ford"; break;
case 45: model=Jaguar; cout<<"Jaguar"; break;
case 46: model=Lexus; cout<<"Lexus"; break;
case 55: model=Maybach; cout<<"Maybach"; break;
case 65: model=RollsRoyce; cout<<"RollsRoyce"; break;
case 111: model=Saab; cout<<"Saab"; break;
}
cout<<endl<<endl;
return 0;
}
3.
#include <iostream>
using namespace std;
typedef int plote;
struct shprehja
{ double z;
int n;
plote x;
};
int main ()
{
shprehja alfa;
int i;
double s;
cout<<"Ulazna vrednost x=";
cin>>alfa.x;
cout<<"Vrednost za n=";
cin>>alfa.n;
s=0;
for(i=0;i<=alfa.n;i++)
s=s+(-2*i+1);
alfa.z=6*alfa.x-3*s;
cout<<"z= "<<alfa.z<<endl;
return 0;
}

_________________________________________________________________________________________

You might also like