Sunday, July 26, 2009

C++ question. Pretty simple.?

My full code can be found at.


http://seklym4.t35.com/c++/Multiples%20p...


I just want to know if there is any way to, instead of putting


a++ 5 times, just put something like


a++ *5


or


a + 5


or, instead of putting an actual number, just put the variable, like to turn


a = 5;


for( int b = a ; a %26lt;= b * 5; a++, a++, a++, a++, a++ ){





into


a = 5;


for( int b = a ; a %26lt;= b * 5; a + b){





Thanks so much for your help.








BTW...


I'm using Bloodshed Dev-C++, just in case my code doesn't


work in your compiler...

C++ question. Pretty simple.?
there is a better way to do it your doing it the hard way...








#include %26lt;iostream%26gt;





using namespace std;





int main(){


int max,iter,b=1,multiple;





cout%26lt;%26lt;"*****Program for Finding Multiples*****\n";


cout%26lt;%26lt; "Up to what number do you wish to find multiples for:";


cin%26gt;%26gt;max;


cout%26lt;%26lt; "How many iterations? : ";


cin%26gt;%26gt;iter;





while(b%26lt;=max){


cout%26lt;%26lt;"\nMultiples of:"%26lt;%26lt;b%26lt;%26lt;"\n\n";


for(int i=1;i%26lt;=iter;i++){


multiple=i*b;


cout%26lt;%26lt;multiple%26lt;%26lt;endl;





}


b++;


}


}





i haven't tested the code but this should work
Reply:huh ?
Reply:*Head Explodes*
Reply:???
Reply:this makes as much sense to me as this does to you!


85y7894u5iu89385788899288*8*%!#%~%*^~)...


huuugh??????


wwwhhhhaaattttt????


!!!!!!!!!!!!!!!!!!!!!!!!!!1
Reply:+ and to the power of 5. (it's a little 5 at right top of +)
Reply:u what ok i am totally a lol!
Reply:Yes, it is pretty simple.
Reply:ok, you must be smart, because i didnt understand anything you said!
Reply:a += 5;





This is the same syntax as has existed forever in the C language.
Reply:what the hell are u talking about????


No comments:

Post a Comment