Exemplo n.º 1
0
main()
{
	register c, i, fraction;
	int r;


	fraction = 0;
	while(c = getchar()) {
		if(!digit(c))  {
			fraction = (c == '.');
			putchar(c);
			continue;
		}
		if(fraction) {
			while(digit(c)) {
				putchar(' ');
				putchar(c);
				if(!(c=getchar()))
					exit(1);
			}
			putchar(' ');
			goto out;
		}

		putchar(' ');
		i = 0;
		line[i++] = '0';
		line[i++] = '0';
		while(c == '0')
			if(!(c=getchar()))
				exit(1);
		while(digit(c)) {
			if(i < 98)
				line[i++] = c;
			if(!(c=getchar()))
				exit(1);
		}
		line[i] = 0;
		r = i/3;
		if(r == 0) {
			print("zero");
			goto out;
		}
		conv(line+i-3*r, r);

out:
		fraction = (c == '.');
		nline();
		printf("...\n");
		if(c != '\n')
			putchar(c);
	}
}
Exemplo n.º 2
0
bool
Cursor::pline(int offset) {
	if ( offset < 0 )
		nline(-offset);

	lineno_t loffset = lineno_t(offset);
	if ( loffset >= lno ) {
		lno = 0;
		return loffset <= lno;
	}

	lno -= loffset;
	return true;
}
Exemplo n.º 3
0
main()
{
    int teller;

    color (WHITE,BLACK,RED);
    screen (8);

    for (teller=0; teller<211; teller++)
    {
        nline (0,teller,255,teller,teller,PST);
    }

    getchar();

    screen (0);
}
Exemplo n.º 4
0
void streambackfire::relaxline(std::vector<vector2f>& line)
{
	vector3f fp,fn,fk;
	std::vector<vector2f> nline(line.size());
	vector2f f,nl;
	vector3f np;
	//for(int i=1;i<line.size()-1;i++)
	int i=rand()%(line.size()-1)+1;
	{
		nl.x=(line[i-1].y-line[i+1].y);
		nl.y=(line[i+1].x-line[i-1].x);
		nl.norml();
		
		float len=(line[i+1]-line[i-1]).abs();
		float step=len*sColl;
		float mv=(randf()-0.5)*step;
		//vector2f temp_b=line[i]+mv*nl;
		vector2f temp_b=line[i];
		line[i].x+=step;
		float r=(func(line[i-1],temp_b)+func(temp_b,line[i+1]));
		r/=(func(line[i-1],line[i])+func(line[i],line[i+1]));
		if(r>1)
		{
			line[i]=temp_b;
			T-=0.00001*T;
			//continue;
		}
		else if(randf()<r)
		{
			line[i]=temp_b;
			T-=0.00001*T;
			//continue;
		}

	}
	/*
	for(int i=1;i<line.size()-1;i++)
	{
		//printf("li(%f,%f)+dl(%f,%f)=",line[i].x,line[i].y,dline[i].x,dline[i].y);
		line[i]=nline[i];
		//printf("(%f,%f)\n",line[i].x,line[i].y);
	}
	//printf("\n");
	*/
}