C++/Lecture 8 – AI in C++
Basic AI-related concepts: decisions, data processing, pattern recognition and route optimization

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int main() {
    // Example 1: Decision-making
    int temperature = 35;
    if (temperature > 30) {
        cout << "AI: It's hot, turning on the cooling system.\n";
    }

    // Example 2: Data processing and analysis
    vector<int> data = {12, 45, 32, 67, 23};
    int max_value = *max_element(data.begin(), data.end());
    cout << "AI: The highest value in data is " << max_value << "\n";

    // Example 3: Pattern recognition
    string input = "hello";
    if (input.find("he") != string::npos) {
        cout << "AI: Pattern 'he' found in input!\n";
    }

    // Example 4: Decision-making
    int scoreA = 80, scoreB = 75;
    string decision = (scoreA > scoreB) ? "Choose A" : "Choose B";
    cout << "AI: Best decision is -> " << decision << "\n";

    // Example 5: Optimization
    vector<int> routes = {15, 10, 25, 8, 20};
    int shortest = *min_element(routes.begin(), routes.end());
    cout << "AI: Shortest route distance is " << shortest << " km.\n";

    return 0;
}
Ready to practice this lecture?