All pastes #820003 Raw Edit

gen

public cpp v1 · immutable
·published 2007-12-17 09:46 UTC
rendered paste body
// inlmningsuppg.3.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>#include <string>using namespace std;void menu();void min_sek();void tim_sek();void tim_min();void sek_tim_min_sek();int _tmain(int argc, _TCHAR* argv[]){	int menu_svar;	char loop;	loop = 'j';	while(loop == 'j' || loop == 'J')	{		menu();		cin >> menu_svar;		switch (menu_svar) 		{				case 1:				min_sek();				break;			case 2:				tim_sek();				break;			case 3:				tim_min();				break;			case 4:				sek_tim_min_sek();				break;			case 5:				cout << "Bye bye";				loop = 'n';				break;			default:				cout << "Ange ett meny-alternativ med siffror - tryck sen enter for att ga vidare" << endl;		}	}	return 0;}void menu(){		cout << "\nOmvandling mellan olika tidsenheter.\n" << endl			 << "1. FRAN MINUTER TILL SEKUNDER" << endl			 << "2. FRAN TIMMAR TILL SEKUNDER" << endl			 << "3. FRAN TIMMAR TILL MINUTER" << endl			 << "4. FRAN SEKUNDER TILL TIMMAR, MINUTER OCH SEKUNDER." << endl			 << "5. AVSLUTA" << endl			 << "\n:";};void min_sek(){	int min;	char loop;	loop = 'j';		while(loop == 'j' || loop == 'J')	{		cout << "Ange antalet minuter som du vill omvandla till sekunder: ";		cin >> min;		min = min * 60;		cout << "Det blir "<< min << " sekund(er)" << endl;		cout << "Vill du omvandla ett nytt tal? : ";		cin >> loop;	}};void tim_sek(){	int tim;	char loop;	loop = 'j';		while(loop == 'j' || loop == 'J')	{		cout << "Ange antalet timmar som du vill omvandla till sekunder: ";		cin >> tim;		tim = (tim * 60) * 60;		cout << "Det blir " << tim << " sekund(er)" << endl;		cout << "Vill du omvandla ett nytt tal? : ";		cin >> loop;	}};void tim_min(){	int tim;	char loop;	loop = 'j';		while(loop == 'j' || loop == 'J')	{		cout << "Ange antalet timmar som du vill omvandla till minuter: ";		cin >> tim;		tim = tim * 60;		cout << "Det blir " << tim << " minut(er)" << endl;		cout << "Vill du omvandla ett nytt tal? : ";		cin >> loop;	}};void sek_tim_min_sek(){	int sek;	int timme;	int minut;	int sekund;	char loop;	loop = 'j';		while(loop == 'j' || loop == 'J')	{		cout << "Ange antalet sekunder som du vill omvandla: ";		cin >> sek;		timme = sek / 3600;		minut = (sek % 3600) / 60;		sekund = (sek % 3600) % 60;		cout << timme << " timmar, " << minut << " minut(er) och " << sekund << " sekund(er)." << endl;		cout << "Vill du omvandla ett nytt tal? : ";		cin >> loop;	}};