Skip to content

Instantly share code, notes, and snippets.

@finoghentov
Created May 31, 2022 09:36
Show Gist options
  • Save finoghentov/7713172797a6f860577e09ebbb905711 to your computer and use it in GitHub Desktop.
Save finoghentov/7713172797a6f860577e09ebbb905711 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double x = 9.45;
std::cout << x << endl;
x = x * 100.0;
std::cout << x << endl;
std::cout << (int)x << endl;
x = x * 10.0;
std::cout << x << endl;
x = x / 10.0;
std::cout << x << endl;
std::cout << (int)x << endl;
return 0;
}
————————————
using namespace std;
int main() {
float x = 9.45;
std::cout << x << endl;
x = x * 100.0;
std::cout << x << endl;
std::cout << (int)x << endl;
x = x * 10.0;
std::cout << x << endl;
x = x / 10.0;
std::cout << x << endl;
std::cout << (int)x << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment