[c] colorizer tests
parent
0f32c8e950
commit
4f3dfc420f
|
@ -0,0 +1,30 @@
|
|||
/* C Program to find roots of a quadratic equation when coefficients are entered by user. */
|
||||
/* Library function sqrt() computes the square root. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h> /* This is needed to use sqrt() function.*/
|
||||
int main()
|
||||
{
|
||||
float a, b, c, determinant, r1,r2, real, imag;
|
||||
printf("Enter coefficients a, b and c: ");
|
||||
scanf("%f%f%f",&a,&b,&c);
|
||||
determinant=b*b-4*a*c;
|
||||
if (determinant>0)
|
||||
{
|
||||
r1= (-b+sqrt(determinant))/(2*a);
|
||||
r2= (-b-sqrt(determinant))/(2*a);
|
||||
printf("Roots are: %.2f and %.2f",r1 , r2);
|
||||
}
|
||||
else if (determinant==0)
|
||||
{
|
||||
r1 = r2 = -b/(2*a);
|
||||
printf("Roots are: %.2f and %.2f", r1, r2);
|
||||
}
|
||||
else
|
||||
{
|
||||
real= -b/(2*a);
|
||||
imag = sqrt(-determinant)/(2*a);
|
||||
printf("Roots are: %.2f+%.2fi and %.2f-%.2fi", real, imag, real, imag);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
#if B4G_DEBUG_CHECK
|
||||
fprintf(stderr,"num_candidate_ret=%d:", num_candidate);
|
||||
for(int i=0;i<num_candidate;++i)
|
||||
fprintf(stderr,"%d,",user_candidate[i]);
|
||||
fprintf(stderr,";");
|
||||
#endif
|
||||
|
||||
void main(O obj) {
|
||||
LOG_INFO("not hilighted as string");
|
||||
LOG_INFO(obj << ", even worse; " << obj.x << " check this out.");
|
||||
// everything from this point on is interpeted as a string literal...
|
||||
O x;
|
||||
std::unique_ptr<O> o(new O);
|
||||
// sadness.
|
||||
|
||||
sprintf(options, "STYLE=Keramik;TITLE=%s;THEME=%s", ...);
|
||||
}
|
||||
|
||||
|
||||
int main2() {
|
||||
printf(";");
|
||||
// the rest of
|
||||
asm("movw $0x38, %ax; ltr %ax");
|
||||
fn("{};");
|
||||
|
||||
// the rest of
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
// classes example
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Rectangle {
|
||||
int width, height;
|
||||
public:
|
||||
void set_values (int,int);
|
||||
int area() {return width*height;}
|
||||
};
|
||||
|
||||
void Rectangle::set_values (int x, int y) {
|
||||
width = x;
|
||||
height = y;
|
||||
}
|
||||
|
||||
int main () {
|
||||
Rectangle rect;
|
||||
rect.set_values (3,4);
|
||||
cout << "area: " << rect.area();
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue