All pastes #906483 Raw Edit

Untitled

public text v1 · immutable
·published 2008-02-16 19:12 UTC
rendered paste body
#include <iostream>
#include <ofstream>
#include <string>

using namespace std;

struct movies{ 
	string titel;
	string betyg;
};

int main()
{ 
	/*int alt; 
	cout << "[1] Skriva in filmer i databasen\n";
	cout << "[2] Hämta filmer från databasen\n";
	cin >> alt;
	if(alt);*/

	//ENDAST ALTERNATIV 1

	movies film;
	ofstream file("filmer.txt", ios::at|ios::app);

	while(true)
	{
		string x;
		cout << "Ange filmtiteln: ";
		getline(cin, x);

		if( !x.size() )
			break;

		film.titel = x;

		cout << "Ange betyg skala 1-10: ";
		getline(cin, x);

		if( !x.size() )
			break;

		film.betyg = x;

		file << "------------------------ "
     		<< "|	Titel		|"
     		<< "------------------------"
     		<< "film.titel
     		<< "------------------------ "
     		<< "|	Betyg		|"
     		<< "------------------------"
    		<< "film.betyg;
	}

	file.close();
	return 0;
}