Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://vk.com/evgenykravchenko0
- ___ ___ ___
- / /\ ___ / /\ / /\
- / /:/_ /__/\ / /:/_ / /:/_
- / /:/ /\ \ \:\ / /:/ /\ / /:/ /\
- / /:/ /:/_ \ \:\ / /:/_/::\ / /:/ /:/_
- /__/:/ /:/ /\ ___ \__\:\ /__/:/__\/\:\ /__/:/ /:/ /\
- \ \:\/:/ /:/ /__/\ | |:| \ \:\ /~~/:/ \ \:\/:/ /:/
- \ \::/ /:/ \ \:\| |:| \ \:\ /:/ \ \::/ /:/
- \ \:\/:/ \ \:\__|:| \ \:\/:/ \ \:\/:/
- \ \::/ \__\::::/ \ \::/ \ \::/
- \__\/ ~~~~ \__\/ \__\/
- ___
- /__/\ ___ ___
- \ \:\ / /\ / /\
- \ \:\ / /:/ / /:/
- _____\__\:\ /__/::\ /__/::\
- /__/::::::::\ \__\/\:\__ \__\/\:\__
- \ \:\~~\~~\/ \ \:\/\ \ \:\/\
- \ \:\ ~~~ \__\::/ \__\::/
- \ \:\ /__/:/ /__/:/
- \ \:\ \__\/ \__\/
- \__\/
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main(int argc, const char * argv[])
- {
- int a = 0;
- int b = 0;
- int c = 0;
- int d = 0;
- int result_c = 0;
- int result_asm = 0;
- int x = 0;
- int e = 0;
- int dividend = 0;
- int divider = 0;
- int check = 0;
- cout << "This program calculate: ((A * X + B) / (C * X + D)) / E \n" ;
- cout << "Enter value A: " ;
- cin >> a ;
- cout <<"Enter value B: " ;
- cin >> b ;
- cout << "Enter value C: " ;
- cin >> c;
- cout << "Enter value D: ";
- cin >> d ;
- cout << "Enter value E: ";
- cin >> e ;
- while(e == 0)
- {
- cout << "WARNING! :: E cannot be equal 0 \n";
- cout << "Enter value E: ";
- cin >> e ;
- }
- cout << "Enter value X: ";
- cin >> x ;
- check = c * x + d;
- while(check == 0)
- {
- cout << "WARNING! :: C * X + D cannot be equal 0 \n";
- cout << "Enter value C: ";
- cin >> c ;
- cout << "Enter value D: ";
- cin >> d ;
- cout << "Enter value X: ";
- cin >> x ;
- check = c * x + d;
- }
- result_c = ((a * x + b) / (c * x + d)) / e ;
- asm
- {
- mov eax , a
- imul x
- add eax , b
- mov dividend , eax
- }
- if(b)
- {
- asm
- {
- mov eax , c
- imul x
- add eax , d
- mov divider , eax
- mov eax , dividend
- cdq
- idiv divider
- cdq
- idiv e
- mov result_asm , eax
- }
- cout << "Result on Asm : " << result_asm;
- cout << "\n" ;
- }
- else
- {
- cout << "Result on Asm : 0";
- cout << "\n" ;
- }
- cout << "Result on C++ : " << result_c;
- cout << "\n" ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement