| | |
Exponitial Loop
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Mar 2007
Posts: 14
Reputation:
Solved Threads: 0
this is about making a loop for powers
stripe3 is the variable
how do u do stripe3*10 stripe3 times
for example if stripe3 = 5
then my question is how do u do 5*10 5 times
because there isnt an opperation in c++ for exponents
so i was thinking of making a loop but i can't figure out
how to write a loop for this ?
also sence before hand i am going to have a user input a value for a couple things including stripe3 and then the loop will calculate then out put the answer any ways im wondering if i should use cin and cout or printf and scanf for the user input stuff also i cant seem to figure out how to combine a user input with cin and cout with loops and if else statements and the data after compiled comes out wrong.
could you guys help me out with this i'd apreaciate it thanks.
stripe3 is the variable
how do u do stripe3*10 stripe3 times
for example if stripe3 = 5
then my question is how do u do 5*10 5 times
because there isnt an opperation in c++ for exponents
so i was thinking of making a loop but i can't figure out
how to write a loop for this ?
also sence before hand i am going to have a user input a value for a couple things including stripe3 and then the loop will calculate then out put the answer any ways im wondering if i should use cin and cout or printf and scanf for the user input stuff also i cant seem to figure out how to combine a user input with cin and cout with loops and if else statements and the data after compiled comes out wrong.
could you guys help me out with this i'd apreaciate it thanks.
•
•
Join Date: Mar 2007
Posts: 14
Reputation:
Solved Threads: 0
ok i created a program for it but now how do i output the result?
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <math.h> using namespace std; int main() { float a,b,c; a=0; b=0; cout<<"enter first stripe number"<<endl; cin>>a; cout<<"enter second stripe number"<<endl; cin>>b; pow(a,b); system ("pause"); }
•
•
Join Date: Mar 2007
Posts: 14
Reputation:
Solved Threads: 0
so like this?
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <math.h> using namespace std; int main() { float a,b,c; a=0; b=0; cout<<"enter first stripe number"<<endl; cin>>a; cout<<"enter second stripe number"<<endl; cin>>b; a_variable_float = pow(a,b); system ("pause"); }
![]() |
Other Threads in the C++ Forum
- Previous Thread: help using decimals in program
- Next Thread: Move Mouse in C++
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node output parameter pointer problem program programming project proxy python read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






