Results 1 to 3 of 3
Thread: C++
Hybrid View
-
29th May 2013 20:39 #1Registered User
Join Date: Dec:2008
Location:
Posts: 438
C++
a,b,c d, n . - . .Code:#include <stdio.h> #include <conio.h> void main() { float *a, *b, *c, *d, kv; int n, k=0, br=0; printf("Zadaite n: "); scanf("%d",&n); a = new float[n]; b = new float[n]; c = new float[n]; d = new float[n]; for (int i=0;i<n;i++) { printf("a[%d]: "); scanf("%d",&n); printf("b[%d]: "); scanf("%d",&n); printf("c[%d]: "); scanf("%d",&n); printf("d[%d]: "); scanf("%d",&n); } kv = (a[0]+b[0]+c[0]+d[0])/4; for(i=1;i<n;i++) { float usp = (a[i]+b[i]+c[i]+d[i])/4; if( usp > kv ) { k = i; kv = usp; } } for(i=0;i<n;i++) { if (a[i]>=3 && b[i]>=3 && c[i]>=3 && d[i]>=3 ) { br++; } } delete a; delete b; delete c; delete d; printf("Studenta s nai-visok uspeh: %f\n",k); printf("Studenti bez dvoiki: %f\n",br); getch(); }
? - ?
-
29th May 2013 21:09 #2
-
30th May 2013 10:19 #3
:
, - . , ... :-DCode:printf("a[%d]: "); scanf("%d",&n); printf("b[%d]: "); scanf("%d",&n); printf("c[%d]: "); scanf("%d",&n); printf("d[%d]: "); scanf("%d",&n);
Pesho :Code:float usp = (a[i]+b[i]+c[i]+d[i])/4;
Code:printf("Studenta s nai-visok uspeh e #%d s uspeh %f\n",k, kv); printf("Studenti bez dvoiki: %d\n",br);ASRock B550M Pro 4; Ryzen R5 3600; 2x16 GiB G.SKILL Aegis 3200; 1TB Samsung QVO 960 + 3TB Seagate IronWolf; Zalman Z1




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