umm the idea is to write an algorithm that calculates the wanted values and prints them. So why don't you start with writing a sequence of steps that the computer should perform in order to fullfill the given task? I will help give you a start:
1) currentNumber=0
2) print currentNumber^2
...
finalStep: if currentNumber is 10 then do (___)
else do (___)
So go ahead and try to fill the (___) spots and the steps that are taken between 2) and the finalStep.
I don't know maybe it just need to print the table
plz I realy need to heeeeeeeeeeeeeeeelp
All I'll tell you is that tab is '\t'
('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@> Ah Malbolge
okay I try it and the black screen was like this
integer 1 2 3 4 5 6 7 8 9
10 cube 1 4 9 16...-------------------------------------
please I have 15 Minutes to do it
I swear I will no ask again
I'm in trouble help me
I just want to know how I can print it in rows
All right... you need to write a function that does this generically, IE it performs the algorithmic work taking in user values. The function should be of this type signature:
int getPower(int val, int exp)
This function simply takes in a value as val, multiplies it by itself exp times, and returns the result. The main function (which should be int and not void) should have two nested loops, the first one to print out each line of values, the second to print out each returned value and tabulate as necessary. That's what you need, just write it out.
Code:int getPower(int val, unsigned int exp) { // This function shoud return val to the power of exp, whatever exp is. } int main(void) { // All you need here is two for loops. for (int i = 1; /* Some kind of check to determine if to loop again */ ; ++i) { for (int j = 1; /* Again, you're on your own. */ ; ++j) { // A printf command that prints the value of getPower on i and j, and prints a tabulation. } } }
Wow I changed my sig!
Thanks alot to everyone helped me![]()
nvm
Last edited by cdg10620; 03-23-2010 at 06:55 AM. Reason: Answer already posted
-CDG10620
Software Developer
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks