Quick actions

cmd+k|ctrl+k

Navigation

Languages

UAS NO.4.2

Snippet info

Language

Cpp

Visibility

public

Author

rifqiherdiyansah08

Created

2024-01-27T21:10:02.847919Z

Updated

2024-01-27T21:10:02.847919Z

#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
#include <cmath>

//Nama : Muhammad Rifqi Herdiyansah
//NIM  : 3420220014
//Prodi: Teknik Informatika
using namespace std;

// Headers
string toString (double);
int toInt (string);
double toDouble (string);

int main() {
    int n;
    cin >> n;
    if (n >= 50) {
        n = n - 25;
    }
    n = n + 10;
    cout << n << endl;
    return 0;
}

// The following implements type conversion functions.
string toString (double value) { //int also
    stringstream temp;
    temp << value;
    return temp.str();
}

int toInt (string text) {
    return atoi(text.c_str());
}

double toDouble (string text) {
    return atof(text.c_str());
}
INFO