Beispiel #1
0
void problem_2(graph<Person> g, Person person) {
  if (person.likes.len() < 2) {
    cout << "You succcccc " << endl;
    return;
  }


  LList<Person> friendsOfFriends = findFriendsOfFriends(g, person);
  LList<Person> result = filterByCommonInterests(friendsOfFriends, person, 2);

  cout << "Friends of Friends:" << endl;
  friendsOfFriends.print();
  cout << endl;
  cout << "Friends of Friends with 2 interests:" << endl;
  result.print();
}
int serve_level(string riddle, string answer, string allowable_chars) {
	bool correct_answer = false;
	int player_input_1;
	char player_input_2;
	LList<char> l;

	cout << riddle << endl;
	while(!correct_answer) {
		player_input_1 = 0;
		cout << "Available letters: " << allowable_chars << endl;
		cout << "Choose something to do to the list: " << endl;
		cout << "[1] to Append a letter to the back of the list. " << endl;
		cout << "[2] to Push a letter to the front of the list. " << endl;
		cout << "[3] to Delete a letter from the list. " << endl;
		cout << "The list will be printed out each time you modify it. " <<endl;
		cin >> player_input_1;
		if(player_input_1 == 1) {
			cout << "Select a letter to append. " << endl;
			cin >> player_input_2;
			if(allowable_chars.find(player_input_2) != string::npos) {
				l.append(player_input_2);
				cout << player_input_2 << " appended to the list! " << endl;
				l.print();
			} else {
				cout << "Please use a valid letter! ";
			}
		} else if(player_input_1 == 2) {
Beispiel #3
0
int main()
{
        LList c;
        int k;
        cin>>k;
        for (int i=1; i<=k; ++i) {
                for (int j=0; j<=i; ++j)
                        c.insert(fraction(j,i));
        }
        c.print();
        return 0;
}