Compare cert salaries and plan your next career move
for (int i = 0; i< 5; i++) { // print space for (int j = i; j>0; j--) cout << " "; // print *'s for (int k = 5-i; k>0; k--) cout << "*"; }
2lazybutsmart wrote: Couldn't get the spaces to show up properly don't know why).
***** **** *** ** *
Sartan wrote: 2lazybutsmart wrote: Couldn't get the spaces to show up properly don't know why). Just encapsulate them in the "code" format: ***** **** *** ** * heh.. guess not
2lazybutsmart wrote: joblesselement: that looks great. I'm not that good in c++ but it's more or less much like C.
2lazybutsmart wrote: anyways, your logic looks neat.
2lazybutsmart wrote: just couldn't understand what the "cout" means. Is that like the printf in C, or did you mean "count"?
JOblessELement wrote: You're bound to learn it from me if you keep posting more of these so-called "brainteasers" :P On a serious note, you should get into C++ or Java, that is, if you want something more challenging than network troubleshooting.
// top pyramid for (int x = 1; x<=5; x++) { printPyr(x); } // bottom upside down pyramid for (x = 5; x>=1; x--) { printPyr(x); } void printPyr(int i) { // print space for (int m = 5; m>i; m--) cout << " "; // print 1 to n for (int n = 1; n<=i; n++) cout << n; // print n-1 to 1 for (int o = i-1; o >= 1; o--) cout << o; // print new line cout << endl; }
2lazybutsmart wrote: You gotta use your hands to crank out the code and your head to cough out the logic.
2lazybutsmart wrote: Q: n = 12345. Reverse this number so that the result is 54321. You're not allowed to use any functions and You're not allowed to use Control Structures.
int num = 12345; ostringstream ostringnum; // push into output string ostringnum << num; string str_num = ostringnum.str(); // reverse reverse(str_num.begin(), str_num.end()); istringstream iss(str_num); int new_num; // push num from input string to new integer iss >> new_num; cout << new_num;
... so I'm not gonna say anything about it
Oh ... do let me know how your friend did it because I can't think of a way without using either a control loop or a pre-defnied function (reverse).
Here's the fastest way I'd do it with C++ strings and C++'s STL. Sorry if none of it makes sense.
n="12345" For i=1 to 5 s= s & right(n,1) n= mid(n,1,5-i) Next
2lazybutsmart wrote: Imagine a person using C++ together with the OOP functionality and the visual capabilities of VB; that person really rocks.
2lazybutsmart wrote: Programmers now value ease and time more than anything else.
2lazybutsmart wrote: You can use Loop's. You're only not allowed to use If's and switches/cases.
int num = 12345; while( num > 0 ) { cout << num%10; num /= 10; }
OK. try out this one, which is more or less a variation of the previous problem when you're done.
JOblessELement wrote: What do you think *Visual* C++ (and now C#) .Net and MFCs (Microsoft Foundation Classes) are all about then?
int n,i,j=0; n=12345; while (n != 0) { i = n % 10; n= n / 10; j= (j*10) + i; }
Check out this article that wants the *fun* put back into programming :
2lazybutsmart wrote: That was a good one; I'll have to admit. Here's the solution
2lazybutsmart wrote: but the only difference here is that you're printing the value retieved by %ing it by 10 instead of storing it in a variable.
int i,n=0; cin >> n; // accept input from console while (n != 0) { i = (i*10) + (n%10); n= n / 10; }
Did you do programming as a hobby; or was it your major in university?
but VB together with SQL Server. Now since I'm certified in both
I'll try to learn as much as I can from C
JOblessELement wrote: int i,n=0; cin >> n; // accept input from console while (n != 0) { i = (i*10) + (n%10); n= n / 10; }
Is this what you have your MCSD in?
I've personally never considered a programming certification because quite frankly, I'd like to think I can walk into an interview and prove my proficiency with my raw fresh-outta-college-with-2-yr-experience skills. Though with the way the current IT market is, I'm beginning to have second thoughts ...
And to make things worse, the *network-adminER*-me is in debate with the programmer-me and it's becoming increasingly harder to make a choice Just wasting more valuable time ... I just hope I find a job and not have to go into certs at all ...
JOblessELement wrote: One train leaves Los Angeles at 15mph heading for New York. Another train leaves from New York at 20mph heading for Los Angeles on the same track. If a bird, flying at 25mph, leaves from Los Angeles at the same time as the train and flies back and forth between the two trains until they collide, how far will the bird have traveled?
2lazybutsmart wrote: ... and one twelfth as a teenager.
Compare salaries for top cybersecurity certifications. Free download for TechExams community.