main(void)
{
  int i = secti(1, 2);
  printf("%d\n", i);

  return 0;
}
int main()
{
  int j;

  printf("Zadej dve cela cisla: ");
  j = secti();
  printf("Sectena cisla = %d\n", j);
  return 0;
}
Beispiel #3
0
Datei: main.c Projekt: Kobzol/soj
int main(int argc, char** argv)
{
	/*printf("%s", pozdrav);
	
	for (int i = 0; i < delka; i++)
	{
        index = i;
        value = i;
		do_pole();
		printf("%d\n", vrat_pole()[i]);
	}*/
	
	retezec_zmen();
	printf("%s\n", retezec);
	
	x1 = 1;
	x2 = 1;
	x3 = 3;
	printf("%d\n", secti());
	
	return 0;
}
Beispiel #4
0
int main(int argc, char *argv[])
{
	// promenne		
	//char buffer[BUFFER_SIZE]; // pole znaku
	int i = 0;
	int j = 0;
	char ch;
	float fl = 0;
	double dbl = 15.3;

	const int pole[] = {1, 2, 3, 4, 5, 6, 7};
	int velikostPole = 0;
	
	int a = 5;
	int x = 0;
	int y = 0;

	int prvni = 0;
	int druhe = 0;
	int result = 0;

	//-----------------------------------------------------------------------------------------------------------------------------------
	setCmdTextColor(TEXT_RED);
	printf("VITEJTE V CVICENI C. 3!\n\n");
	setCmdTextColor(TEXT_WHITE);

	// operatory	
	i = !i;
	printf("i = %d \n", i); 

	i = 10;

	i++; 
	printf("i = %d \n", i);
	++i; 
	printf("i = %d \n", i);

	i--;
	printf("i = %d \n", i);
	--i;
	printf("i = %d \n", i);

	i = i + 1;
	i = i - 1;

	printf("i / 2 = %d \n", i / 2);
	printf("i * 2 = %d \n", i * 2);
	printf("Zbytek po deleni = %d \n", i % 3);

	i += 1;
	i -= 1;

	if ( i > 0 && i <= 15 )
		printf("Od peti do patnacti... \n");

	if ( i == 10 ) 
		printf("Deset \n");

	j = 5;
	if ( i == 10 || j > 1)
		printf("Podminka splnena \n");

	j *= 2;
	printf("j = %d \n", j );

	j /= 2;
	printf("j = %d \n", j );

	printf("sizeof int = %d \n", sizeof(j));
	printf("sizeof char = %d \n", sizeof(ch));
	printf("sizeof float = %d \n", sizeof(fl));
	printf("sizeof double = %d \n", sizeof(dbl));
		
	printf("velikost pole = %d \n", sizeof(pole) / sizeof(pole[0]));
	velikostPole = sizeof(pole) / sizeof(pole[0]);

	printf("a = %d \n", a);
	a = a++ + ++a; // nedefinovany stav
	printf("a = %d \n", a);

	//-----------------------------------------------------------------------------------------------------------------------------------
	// ternarni operatory
	x = (x == 0) ? 1:11;
	printf("x = %d \n", x);
	
	// slozeny ternarni operator -> tohle neni dobry napad
	y=x>0?x<10?x:x>9000?9001:0:0;
	printf("y = %d\n",y);
	
	if(x>0 && x < 10)
		y = x;
	else if (x > 9000)
		y = 9001;
	else
		y = 0;
	
	// operator carky
	for(x=0, y=0; x<5; x++, ++y){
		printf("x = %d, y = %d \n", x, y);
	}
	
	//-----------------------------------------------------------------------------------------------------------------------------------
	// makra
	printf("%s \n", AHOJ);
	NAZDAR;
	printf("%d \n", POWER(10));
	SOUCET(x, y);

	//-----------------------------------------------------------------------------------------------------------------------------------
	// funkce

	printf("Zadej prvni cislo: ");
	scanf("%d", &prvni);

	printf("Zadej druhe cislo: ");
	while (!scanf("%d", &druhe))
	{
		fflush(stdin); 
		printf("Zadej cislo: ");	
	}
	result = secti(prvni, druhe);
	printf("A+B = %d  \n", result);

	printPole(pole, velikostPole);

	//-----------------------------------------------------------------------------------------------------------------------------------
	// podmineny preklad

	setCmdTextColor(TEXT_YELLOW);
#ifndef NDEBUG
	printf("DEBUG \n");
#else
	printf("RELEASE \n");
#endif
	setCmdTextColor(TEXT_WHITE);

	//-----------------------------------------------------------------------------------------------------------------------------------
	// booleovska algebra
	for(i = 0; i <= 15; i++){
		printf("i = %2d --> ", i);

		if((i >= 5) && (i <= 10)){
			printf("AND True , ");
		}else{
			printf("AND False, ");
		}

		if((i < 5) || (i > 10)){
			printf("OR True  \n");
		}else{
			printf("OR False \n");
		}
	}

	return 0;
}
int main()
{
  printf("Zadej dve cela cisla: ");
  printf("Sectena cisla = %d\n", secti());
  return 0;
}