Thursday, 11 July 2024

Program Perbaikan UAS 2

 #include <iostream>

#include <string>

#include <iomanip>

#include <cmath>

using namespace std;


bool cekPrima(int num) {

    if (num <= 1) return false;

    for (int i = 2; i <= sqrt(num); i++) {

        if (num % i == 0) return false;

    }

    return true;

}

Program Perbaikan UAS 1

 #include <iostream>

#include <iomanip>

#include <string>

using namespace std;


struct Barang {

    string nama;

    double harga;

    int jumlah;

};


struct Pelanggan {

    string NIK;

    string nama;

    string alamat;

    int umur;

    long pembelian;

};


int main() {

    string password = "password";


    string inputPassword;


    bool passwordBenar = false;