Results 1 to 25 of 29
Thread: C++
Hybrid View
-
25th June 2013 01:25 #1Registered User
Join Date: Aug:2012
Location:
Posts: 297
C++
, C++. enum. :
, n,m,p q (op1,op2,op3) +,0,*,/, (((n op1 m)) op2 p) op3 q), ( ).
, 3 ( 1, 2, 2 3) op1,op2,op3 +,-,*,/ ? enum, enum (.. ). .. .. .
,.
-
25th June 2013 09:16 #2Game programmer
Join Date: Feb:2007
Location:
Posts: 1,948
:
enum-a .Code:switch(operation) { case divide: result = v1/v2; break; case multiply: result = v1*v2; break; case add: result = v1+v2; break; case subtract: result = v1-v2; break; }3700X | 3070Ti | 64GB RAM | 2TB SSD | Seasonic 750W | FD Define 7 Mini
-
25th June 2013 16:55 #3Registered User
Join Date: Aug:2012
Location:
Posts: 297
, . , .
-
12th August 2013 12:12 #4Registered User
Join Date: Aug:2012
Location:
Posts: 297
,. :
#include <iostream>
using namespace std;
int main()
{
cout << " Vuvedete 4 chisla"<<endl;
int m,n,p,q,broi=0;
cin >>m>>n>>p>>q;
cout <<" Vuvedete specialno chislo"<<endl ;
double a;
cin >>a;
enum op{op1,op2,op3,op4};
op d,e,f;
double s,g,h;
for (d=op1;d<=op4;d=(op)(d+1))
{
s=0;
g=0;
switch(d)
{
case op1 : s=m+n;break;
case op2 : s=m-n;break;
case op3 : s=m*m;break;
case op4 : s=m/n;break;
}
g=s;
for (e=op1;e<=op4;e=(op)(e+1))
{
s=g;
switch(e)
{
case op1 : s=s+p;break;
case op2 : s=s-p;break;
case op3 : s=s*p;break;
case op4 : s=s/p;break;
}
h=s;
for (f=op1;f<=op4;f=(op)(f+1))
{
s=h;
switch(f)
{
case op1 : s=s+q;break;
case op2 : s=s-q;break;
case op3 : s=s*q;break;
case op4 : s=s/q;break;
}
if (s==a)
{
broi++;
if (broi==1) cout <<"Realnite resheniq na vashiqt problem sa: "<<endl;
switch(d)
{
case 0 : cout << "(+,";break;
case 1 : cout << "(-,";break;
case 2 : cout << "(*,";break;
case 3 : cout << "(/,";break;
}
switch(e)
{
case 0 : cout << "+,";break;
case 1 : cout << "-,";break;
case 2 : cout << "*,";break;
case 3 : cout << "/,";break;
}
switch(f)
{
case 0 : cout << "+)"<<endl;break;
case 1 : cout << "-)"<<endl;break;
case 2 : cout << "*)"<<endl;break;
case 3 : cout << "/)"<<endl;break;
}
}
s=h;
}
}
}
if (broi==0) cout << "There`re no real soliutions of your problem"<<endl;
system("pause" );
return 0;
}
(op1,op2,op3) . , ASCII . ? ASCII . , , ( ). ?, ?
.. , . , , ... ...
, - . .Last edited by DuMBo0o; 12th August 2013 at 13:36.
-
13th August 2013 10:32 #5
, / , .../
- , [ code ] [ /code ] ( ) :
- case , . 1/3 .Code:#include <iostream> using namespace std; int main() { cout << " Vuvedete 4 chisla"<<endl; int m,n,p,q,broi=0; cin >>m>>n>>p>>q; cout <<" Vuvedete specialno chislo"<<endl ; double a; cin >>a; enum op{op1,op2,op3,op4}; op d,e,f; double s,g,h; for (d=op1;d<=op4;d=(op)(d+1)) { s=0; g=0; switch(d) { case op1 : s=m+n;break; case op2 : s=m-n;break; case op3 : s=m*m;break; case op4 : s=m/n;break; } g=s; for (e=op1;e<=op4;e=(op)(e+1)) { s=g; switch(e) { case op1 : s=s+p;break; case op2 : s=s-p;break; case op3 : s=s*p;break; case op4 : s=s/p;break; } h=s; for (f=op1;f<=op4;f=(op)(f+1)) { s=h; switch(f) { case op1 : s=s+q;break; case op2 : s=s-q;break; case op3 : s=s*q;break; case op4 : s=s/q;break; } if (s==a) { broi++; if (broi==1) cout <<"Realnite resheniq na vashiqt problem sa: "<<endl; switch(d) { case 0 : cout << "(+,";break; case 1 : cout << "(-,";break; case 2 : cout << "(*,";break; case 3 : cout << "(/,";break; } switch(e) { case 0 : cout << "+,";break; case 1 : cout << "-,";break; case 2 : cout << "*,";break; case 3 : cout << "/,";break; } switch(f) { case 0 : cout << "+)"<<endl;break; case 1 : cout << "-)"<<endl;break; case 2 : cout << "*)"<<endl;break; case 3 : cout << "/)"<<endl;break; } } s=h; } } } if (broi==0) cout << "There`re no real soliutions of your problem"<<endl; system("pause" ); return 0; }
- / /.ASRock B550M Pro 4; Ryzen R5 3600; 2x16 GiB G.SKILL Aegis 3200; 1TB Samsung QVO 960 + 3TB Seagate IronWolf; Zalman Z1
-
15th August 2013 17:43 #6Registered User
Join Date: Aug:2012
Location:
Posts: 297
case . C++ . , , , , , . - , . , 1 1 1 1, 2 , +,-,- , 1+1-1-1 2 . . , .
, ., , .
(- ) ,, .
m n m n , , .. . ( a[3x3]) - a02 , a01 , a12 , a00 , a11 , a22 , a10 , a21 , a20 , akt k+1 t+1 .
, .
..Code:#include <iostream> using namespace std; int main() { cout <<" Vuvedete n: "; int n; cin>>n; cout <<" Vuvedete m: "; int m; cin >>m; int a[20][20]; for(int i=0;i<=n-1;i++) for(int k=0;k<=m-1;k++) { cout << " Vuvedete <" << i+1<<","<< k+1 <<">" ; cin>>a[i][k]; } //Izvejdane na chislata nad diagonala i na diagonala vkliuchitelno for(int i=n-1;i>=0;i--) { int r=i; for(int k=0;k<=n-1-i;k++) { cout<<a[k][r]<<" \t" ; r++; } } //Izvejdane na chislata pod diagonala for(int i=1;i<=n-1;i++) { int r=i; for(int k=0;k<=n-1-i;k++) { cout << a[i][k]<<"\t" ; r++; } } system("pause"); return 0; }
:
Code:#include <iostream> using namespace std; int main() { cout <<" Vuvedete n: "; int n; cin>>n; cout <<" Vuvedete m: "; int m; cin >>m; int a[20][20]; //Vuvejdane na chislata for(int i=0;i<=n-1;i++) for(int k=0;k<=m-1;k++) { cout << " Vuvedete <" << i+1<<","<< k+1 <<">" ; cin>>a[i][k]; } //Vuvejdane na chislata pod diagonala i na diagonala for (int i=n-1;i>=0;i--) for(int k=0;k<=n-1-i;k++) cout<<a[i+k][k]<<" \t" ; //Vuvejdane na chislata nad diagonala for(int k=1;k<=n-1;k++) for(int i=0;i<=n-k-1;i++) cout<<a[i][k+i]<<"\t"; system("pause"); return 0; }Last edited by DuMBo0o; 15th August 2013 at 19:32.




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in