All pastes #804660 Raw Edit

Tulostus()

public c v1 · immutable
·published 2007-12-03 17:36 UTC
rendered paste body
// Tulostusfunktio TOIMII VAIN ALLE 7 MERKIN NIMILLÄ, ALLE 100 HINNOILLA JA ALLE 6 MÄÄRILLÄ// MITÄ KEKSITÄÄN???void tulostus(Tavara* tuote){	int i;	double yhthinta=0;	int yhtmaara=0;		printf("nimi \t\t hinta \t m\x84\x84r\x84\n"); // Tulostetaan otsikot	printf("============= \t ===== \t =====\n"); // Tulostetaan ensimmäiset väliviivat	for(i=0;i<TAVARAT_KOKO;i++) // Käydään läpi taulukko ja tulostetaan vain niiden alkioiden sisältö, joilla on nimi (=ei ole tyhjä)	{		if( strcmp(tuote[i].nimi,"")!=0)		{		printf("%s \t\t %2.2f \t %5d\n",tuote[i].nimi,tuote[i].hinta,tuote[i].kpl);		yhtmaara += tuote[i].kpl; // Lasketaan samalla Yhteensä -rivin arvot		yhthinta += tuote[i].kpl * tuote[i].hinta;    }	}	printf("============= \t ===== \t =====\n"); // Tulostetaan toiset väliviivat	printf("Yhteens\x84: \t %2.2f \t %5d\n",yhthinta,yhtmaara); // Tulostetaan Yhteensä -rivi}