double x, y ; x = 13.5 ; y = 2*x ;
double p[2] ; p[0] = 13.5 ; p[1] = 2*p[0] ;
struct point { double x ; double y ; } ; struct point P ; P.x = 13.5 ; P.y = 2*P.x ;
class Point { double x ; double y ; public: Point(double, double) ; void setX (double) ; void setY (double) ; double getX (void) ; double getY (void) ; } Point(0.0, 0.0) P ; P.setX(13.5) ; P.setY(2*P.getY()) ;
double dist = sqrt(px*px + py*py) ;
double dotp = p.x*q.x + p.y*q.y ;
double dotp = p[0]*q[1] + p[1]*q[0] ;
double x, y ; puts("Please enter two numbers") ; scanf("%lf %lf", &x, &y) ; printf("The sum of your numbers is %6.2f\n", x+y) ;
if (x > y) { puts("The first was bigger!") ; } else { puts("The second was bigger!") ; }
for (int i=100 ; i>0; i = i-1) { printf("%3d\n", i) ; } puts("Blastoff!") ; count = 0 ; while (x ~= 1) { if (x%2 == 0) { x = x/2 ; } else { x = 3*x+1 ; } ++count ; }
double midi2freq(int midiNum) { /* MIDI number 69 is A440 */ int halfStepsFromA440 = midiNum - 69 ; double relFreq = pow(2, halfStepsFromA440/12.0) ; return relFreq * 440 ; } double freq midC = midi2freq(60) ;
You could write the kernel of an operating system, represent a polygon mesh, or toggle LED's with a switch.