| | |
Cubic Numbers
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
How to i get cubic numbers into a program?
Ive tried ^3, but in this line:
x = creat^3;
y = lines*20;
z = x+y;
cout<<"Your zenii for this post is " << z << ".\a" << endl;
If i change the cout to call out x it calls it out as 0, when i input the creat i use 3, so it should cube it to 27, but it calls out 0, why is this? How can i fix it?
Ive tried ^3, but in this line:
x = creat^3;
y = lines*20;
z = x+y;
cout<<"Your zenii for this post is " << z << ".\a" << endl;
If i change the cout to call out x it calls it out as 0, when i input the creat i use 3, so it should cube it to 27, but it calls out 0, why is this? How can i fix it?
The operator ^ is the bitwise XOR operator, not a cubic operator. There isn't a cubic operator. You can get the 3rd power of a number by using * like this:
C++ Syntax (Toggle Plain Text)
int n = 2 * 2 * 2 ;
Perhaps you mean to do
Anyway please post your code again after you've made any changes.
C++ Syntax (Toggle Plain Text)
x = creat * creat * creat;
Anyway please post your code again after you've made any changes.
Ahhhhh, lol thanks thats got it working,
C++ Syntax (Toggle Plain Text)
else if(value == 1) { system("title AnimeDD Zenii Calculator"); system("color 8E"); cout <<"Alright time to calculate your Zenii, get your storyline ratings ready!" << endl; int lines, creat, x, y, z; cout<<"What is your characters name?"<< endl; cin>> name; (name,100); cout<<"Hello, " << name << "."<< endl; cout<<"Put in your creativity rating for the storyline post"<< endl; cin>> creat; cout<<"Thank you, Now put in your line count for the storyline post"<< endl; cin>> lines; x = creat*creat*creat; y = lines*20; z = x+y; cout<<"Your zenii for this post is " << z << ".\a" << endl; cout<< ""<< endl; cout<<"Q - Quit"<< endl; cout<<"R - Repeat"<< endl; cout<<"Please type in the corresponding letter for your choice then press enter."<< endl; cin>> quit; cout<<"Goodbye, " << name << "."<< endl; system("PAUSE"); system("cls"); }
![]() |
Similar Threads
- Cubic equation (C++)
Other Threads in the C++ Forum
- Previous Thread: trial version of Microsft VC++
- Next Thread: Files & streams?
| Thread Tools | Search this Thread |
api array based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





