Skip to content
Snippets Groups Projects
Commit 5baccf9c authored by Andreas Blakli's avatar Andreas Blakli
Browse files

La til:

skrivMeny() funk.
meny() funk.
delOppValg() funk.
ryddOppMinne() funk.
i globaleFunksjoner.h og globalefunksjoner.cpp.
parent 20427718
No related branches found
No related tags found
No related merge requests found
#include "globaleFunksjoner.h"
using namespace std;
extern Stoppesteder* gStoppesteder;
extern Ruter* gRuter;
void skrivMeny() {
cout << "\nS - Stoppesteder" << '\n'
<< "R - Ruter" << '\n'
<< "Q - Avslutt";
}
void meny() {
HjelpeFunksjoner hjelp;
char valg;
do {
skrivMeny();
valg = lesChar("");
switch (valg) {
case 'S':
gStoppesteder->meny();
break;
case 'R':
gRuter->meny();
case 'Q':
break;
default:
cout << "\nUgyldig valg!" << '\n';
break;
}
} while (valg != 'Q');
}
vector<char> delOppValg(const std::string & str) {
HjelpeFunksjoner hjelp;
vector<string> tmp;
vector<char> valg;
int i = 0;
tmp.push_back(hjelp.rensStreng(str));
tmp = hjelp.splittStreng(' ', tmp.back());
if (tmp.size() > 0 && tmp.size() < 3) {
for (const auto & val : tmp) {
if (val == "S" || val == "R" || val == "Q" ||
val == "N" || val == "A" || val == "B" || val == "T")
valg.push_back(static_cast<char>(val.front()));
}
}
return valg;
}
void ryddOppMinne() {
delete gStoppesteder;
delete gRuter;
}
\ No newline at end of file
#ifndef __GLOBALEFUNKSJONER_H
#define __GLOBALEFUNKSJONER_H
#include <iostream>
#include "hjelpeFunksjoner.h"
#include "lesData3.h"
#include "stoppesteder.h"
#include "ruter.h"
void skrivMeny();
void meny();
std::vector<char> delOppValg(const std::string & str);
void ryddOppMinne();
#endif // __GLOBALEFUNKSJONER_H
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment