» »

c++ program

c++ program

kretze ::

dober dan mene pa zanima kako bi uredil program natancneje(static const student) v tej kodi da bi mi delovalo pa hvala za odgovore

/*
Ime in priimek:
Datum:

BESEDILO NALOGE:
*/
//knjiznice
#include <iostream>	// vhodno-izhodni ukazi
#include <stdlib.h> //standardni ukazi
#include <string> // za la?je delo z nizi, veljavno le v C++ in ne v C#
using namespace std; // uporaba imenskega prostora	ni treba pisati std::ukaz


class gradebook
{
private:
	
	string coursename;
	int grades[student];
public:
	static const int student = 10;


static const int student = 10;

	
	
	gradebook(string name, int gradeaaray[])
	{
		coursename = name;

		for (int i = 0; i < student; i++)
			grades[i] = gradeaaray[i];
	}

	
	string getcoursename()
	{
		return coursename;
	}
	void displaymesage()
	{
		cout << "welcome ot the gradebook for" << getcoursename() << endl;
	}

	int getminimum()
	{
		int lowgrade = 100;
		for (int i = 0; i < student; i++)
		{
			if (grades[i] < lowgrade)
				lowgrade = grades[i];
		}
		return lowgrade;
	}

	int getmaximum()
	{
		int highgrade = 0;
		for (int i = 0; i < student; i++)
		{
			if (grades[i]>highgrade)
				highgrade = grades[i];
		}
		return highgrade;
	}

	double getAverage()
	{
		int total = 0;
		int average = 0;
		for (int i = 0; i < student; i++)
			total += grades[i];
		average = total / student;


	}

	void ouputbartchar()
	{
		int freqenzy[11] = {};
		for (int i = 0; i < student; i++)
			++freqenzy[grades[i] / 10];

		for (int j = 0; j < 11; j++)
		{
			if (j == 0)
				cout << "0-9";
			else if (j == 100)
				cout << "100";
			else
				cout << j * 10 << "-" << (j * 10) + 9 << ":";
			for (int stars = 0; stars = freqenzy[j]; stars++)
				cout << "*";
			cout << endl;
		
	}


				
		}
	void ouputgrades()
	{
		cout << "the grades are" << endl;
		for (int i = 0; i < student; i++)
			cout << "student" << i + 1 << grades[i];
	}

	void procesgrade()
	{
		ouputgrades();
		cout << "class average is " << getAverage() << "lowest grade is" << getmaximum() << "highest grade is " << getmaximum() << endl;
		ouputbartchar();
	}
		
	

	




		
	





};

int main()
{
	
	int gradearray[gradebook::student] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 19 };
	gradebook mygrade("c++ programming", gradearray);
	mygrade.displaymesage();




	system("pause");// da is ogledam rezultate na zaslonu
	return 0;
}

hexor ::

V 24. vrstici imaš podvojen ukaz static const int student=10;
RootMachine ;)

kretze ::

sem enega izbrisal pa mi še vedno ne dela..... any help??


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

[C] LPC1343 - UART - AT commands

Oddelek: Programiranje
91136 (1026) JanezovJanez
»

Qt/QML zajem podatkov iz podatkovne baze, dobim samo opise fieldov ter prazne vrednos

Oddelek: Programiranje
71735 (1478) windigo
»

[Qt/C++]problem z Undefined reference na konstanti znotraj razreda

Oddelek: Programiranje
102356 (2026) phantom
»

[c] Enaki datoteki

Oddelek: Programiranje
71038 (898) Spura
»

[C++] Pridobivaje in brisanje le dolocenih znakov

Oddelek: Programiranje
111345 (1139) Gundolf

Več podobnih tem