Γενικά θέματα για το διαγωνισμό. Ερωτήσεις, προτάσεις και ό,τι άλλο ταιριάζει.
-
Panagos
- Δημοσιεύσεις: 6
- Εγγραφή: Δευ Ιαν 14, 2019 12:02 pm
Δημοσίευση
από Panagos »
Κώδικας: Επιλογή όλων
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main()
{
FILE *out=fopen("cntbal.out","w");
srand(time(NULL));
int n=1 + rand() % 1000000; //Edw gia to plhthos
int c;
fprintf(out,"%d\n",n);
for(int i=0; i<n; i++)
{
c= 1 + rand() % 2;
switch(c)
{
case 1:
fprintf(out,"(");
break;
case 2:
fprintf(out,")");
break;
}
}
}
Ελπιζω να βοηθησει!!
-
Panagos
- Δημοσιεύσεις: 6
- Εγγραφή: Δευ Ιαν 14, 2019 12:02 pm
Δημοσίευση
από Panagos »
Κώδικας: Επιλογή όλων
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main()
{
FILE *out=fopen("cntbal.in","w");
srand(time(NULL));
int n=1 + rand() % 100;
int c;
fprintf(out,"%d\n",n);
for(int i=0; i<n; i++)
{
c= 1 + rand() % 2;
switch(c)
{
case 1:
fprintf(out,"(");
break;
case 2:
fprintf(out,")");
break;
}
}
fclose(out);
}
Μια μικρη αλλαγη!