Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#define STRLEN 1024 #define MIN 0 #define MAX 100 #define M_MIN 0.0 #define M_MAX 10.0 #define Q_MIN 0.0 #define Q_MAX 10.0 #define N_PROVE 500 #define SI 1 #define NO 0 #define ABS(X) ((X<0)?-X:X) typedef int* pint; typedef float* pfloat; typedef FILE* pfile; typedef struct _dot { double x; double y; } dot; typedef dot* pdot; double randminmax(double min, double max) { return ((((double)rand())/RAND_MAX)*(max-min))+min; } int conferma(void) { char input[STRLEN]; printf("Confermi? [S,s,Y,y = conferma / ALTRO = non conferma]: "); scanf("%s",input); switch (input[0]) { case 'y': case 'Y': case 's': case 'S': return SI; default: return NO; } } int dotCounter(double m, double q, pdot array, int numero_punti, double epsilon) { pdot p,pmax; int i; for(p=array,pmax=array+numero_punti,i=0;p
y-(m*(p->x)+q))
y=m*(p->x=randminmax(MIN,MAX))+q+randminmax(-rumore,rumore); } dm=(M_MAX-M_MIN)/(N_PROVE-1); dq=(Q_MAX-Q_MIN)/(N_PROVE-1); for(i_m=n=n_max=0,m_best=q_best=0,m=M_MIN;i_m
n_max) { n_max=n; m_best=m; q_best=q; printf("Dati aggiornati hits %d, mb=%f, qb=%f\n",n_max,m_best,q_best); } } } free(pcoord); printf("Ho trovato un coefficiente angolare di %f, un'intercetta di %f, con un numero di hit pari a %d.\n",m_best,q_best,n_max); return EXIT_SUCCESS; err_mem: printf("ERRORE: memoria insufficiente\n"); return EXIT_FAILURE; err_num: printf("ERRORE: hai inserito un numero negativo\n"); return EXIT_FAILURE; }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)