0 Members and 1 Guest are viewing this topic.
#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){ int product, power; float num, rem; double answer, base, conv=1, ten, place; power = 0; ten = 10.0; answer = 0; cout << "Enter number to be converted "; cin >> num; cout << "\n"; cout << "What base do you want to put it in "; cin >> base; cout << "\n"; rem = num; while(base>10) { cout << "please put in a smaller base "; cin >> base; cout << "\n"; } while(conv<=num) { power++; conv=conv*base; } while(rem!=0) { power--; conv=pow(base, power); place = pow(ten, power); product = floor(rem/conv); while(product >= base) { product-=1; } answer += product*place; rem -= product*conv; if(power<=-20) { break; } } cout << "Your answer is " << answer <<"\n"; cout << "\n"; system("PAUSE");}
"B2B - Release" uses an invalid compiler. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...Nothing to be done.
#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){ float bs, cs, s, ra, rb, a, b, c, h, k; cout << "What is a? "; cin >> a; cout << "What is b? "; cin >> b; cout << "\n"; cout << "What is c? "; cin >> c; cout << "\n"; bs = b/a; cs = -1*c/a+pow(bs, 2)/4; s = sqrt(cs); ra = bs/2+s; rb = bs/2-s; h=bs/2; k=a*pow(bs, 2)/4+c; cout << "The First Root is" << ra << "\n"; cout << "the Second Root is" << rb << "\n"; cout << "Vertex is (" << h << "," << k << ")" << "\n"; system("Pause");}
#include <cstdio>#include <cstdlib>#include <iostream>using namespace std;int main(){ int product, power; float num, base, rem, conv=1, place; double answer; cout << "Enter number to be converted"; cin >> num; cout << "What base do you want to put it in"; cin >> base; while(base>10) { cout << "please put in a smaller number"; cin >> base; } while(conv<num) { power++; conv=conv*base; } while(rem!=0) { power-=1; conv=base^power; place = 10^power; product = rem/conv; while(product >= base) { product-=1; } answer += product*place; rem -= product*conv; if(rem<0) { answer -= product*place; rem += product*conv; break; } }}
#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){ int product, power; float num, rem, conv=1, place; double answer, base, ten; cout << "Enter number to be converted"; cin >> num; cout << "\n"; cout << "What base do you want to put it in"; cin >> base; cout << "\n"; while(base>10) { cout << "please put in a smaller number"; cin >> base; cout << "\n"; } while(conv<num) { power++; conv=conv*base; } while(rem!=0) { power--; conv=pow(base, power); place = pow(ten, power); product = rem/conv; while(product >= base) { product-=1; } answer += product*place; rem -= product*conv; if(rem<0) { answer -= product*place; rem += product*conv; break; } }}
#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){ int product, power; float num, rem; double answer, base, conv=1, ten, place; cout << "Enter number to be converted "; cin >> num; cout << "\n"; cout << "What base do you want to put it in "; cin >> base; cout << "\n"; while(base>10) { cout << "please put in a smaller base "; cin >> base; cout << "\n"; } while(conv<=num) { power++; conv=conv*base; } while(rem!=0) { power--; conv=pow(base, power); place = pow(ten, power); product = floor(rem/conv); while(product >= base) { product-=1; } answer += product*place; rem -= product*conv; if(power<=-20) { break; } } cout << "Your answer is", answer;}
power = 0;rem = 0;ten = 0;answer = 0;
#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){ int product, power; float num, rem; double answer, base, conv=1, ten, place; power = 0; rem = 0; ten = 0; answer = 0; cout << "Enter number to be converted "; cin >> num; cout << "\n"; cout << "What base do you want to put it in "; cin >> base; cout << "\n"; while(base>10) { cout << "please put in a smaller base "; cin >> base; cout << "\n"; } while(conv<=num) { power++; conv=conv*base; } while(rem!=0) { power--; conv=pow(base, power); place = pow(ten, power); product = floor(rem/conv); while(product >= base) { product-=1; } answer += product*place; rem -= product*conv; if(power<=-20) { break; } } cout << "Your answer is", answer; cout << "\n"; system("PAUSE");}
cout << "Your answer is", answer;
cout << "Your answer is " << answer << endl; //endl = \n
#include <cstdlib>#include <iostream>#include <math.h>using namespace std;int main(){ int product, power; float num, rem; double answer, base, conv=1, ten, place; power = 0; ten = 0; answer = 0; cout << "Enter number to be converted "; cin >> num; cout << "\n"; cout << "What base do you want to put it in "; cin >> base; cout << "\n"; rem = num; while(base>10) { cout << "please put in a smaller base "; cin >> base; cout << "\n"; } while(conv<=num) { power++; conv=conv*base; } while(rem!=0) { power--; conv=pow(base, power); place = pow(ten, power); product = floor(rem/conv); while(product >= base) { product-=1; } answer += product*place; rem -= product*conv; if(power<=-20) { break; } } cout << "Your answer is " << answer <<"\n"; cout << "\n"; system("PAUSE");}