Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
function [newListOfPersons] = processNewPerson(listOfPersons)
    newData =batchRegisterPersons promptPerson();
    newListOfPersons = [listOfPersons,newData];
end

...

Code Block
function P = processChangePerson (P)
	for i = 1:length(P)
        fprintf('%i. ', i);
        printPerson(P(i));
    end
	index = input ('Hvilken person vil du endre ? ');
	P(index) = promptPerson();
end

i)

Code Block
function personProgram ()
    choice = -1;
    P = [];
    printHeader();
    while choice ~= 0
        printMenu();
        choice = input ('Velg et tall: ');
		clc
        if choice == 0
            continue
        end
        P = process(P, choice);
    end
	willSave = input('Vil du lagre ulagrede endringer? [Y/N]', 's');
		if strcmp(willSave, 'Y')
			process(P, 2);
		end
    printFooter();
end

m)

Code Block
i process(P, choice)
...
  case 6
     processSearchPerson(P);
...
 
i printFooter()
...
    fprintf('%s\n', '6. Søk etter person');
...
 
function processSearchPerson(P)
key = input('Hva heter personen?', 's');
for i = 1:length(P)
    if strcmp(key, P(i).name)
        printPerson(P(i));
        pause(1);
        return
    end
end
fprintf('Kunne ikke finne %s\n', key);
end