» »

c++ programne deluje

c++ programne deluje

kretze ::

zdravo kaj ve kdo zakaj ta program ne deluje?? Error list ne zazna nobene napake

int main()
#include <iostream>	
#include <stdlib.h> 
#include<fstream>
#include <string>
{
	string firstname;
	string lastname;
	double testscore;
	char grade = ' ';
	double sum = 0.0;
	int countt = 0;

	ifstream infile;
	ofstream outfile;

	infile.open("ch5_stdata.txt");

	if (!infile)
	{
		cout << "connot open ouput file program terminates " << endl;
		return 1;
	}

	outfile.open("ch5_stdata.out");

	infile >> firstname >> lastname;
	infile >> testscore;

	while (infile)
	{
		sum += testscore;
		countt++;

		switch(static_cast<int> (testscore))
		{
		case 0:
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
			grade = 'F';
			break;
		case 6:
			grade = 'D';
			break;
		case 7:
			grade = 'C';
				break;
		case 8:
			grade = 'B';
			break;
		case 9:
		case 10:
			grade = 'A';
				break;
		default:
			cout << "invalid score " << endl;
			
			

		}
		outfile << firstname << " " << lastname << " " << testscore << " " << grade << " " << endl;
		infile >> firstname >> lastname;
		infile >> testscore;
	}
	if (countt != 0)
		outfile << "class average " << sum / countt << endl;
	else
		outfile << "no data " << endl;

	infile.close();
	outfile.close();
system("pause");
	return 0;
}

Snackbarru ::



Vredno ogleda ...

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

[C++] problem z binarnimi datotekami

Oddelek: Programiranje
9946 (811) mallard
»

uporaba C++ unmanaged kode v C#.NET projektu

Oddelek: Programiranje
111900 (1623) krho
»

[c++] problem: pretvorba iz malih v velike crke

Oddelek: Programiranje
142124 (1771) Makina
»

[C] čuden izpis iz txt dat. na zaslon

Oddelek: Programiranje
121666 (1403) l0g1t3ch
»

Loopy problem

Oddelek: Programiranje
281469 (978) snow

Več podobnih tem