Answer Posted / maria
1) For checking modulo use
num1&(num2-1)
instead:
num1%num2
2) For multiplying or dividing by 2 use left and right shift
accordingly.
3) In loop use, if code allows it, decrement,like this:
for(int i = MAX_VALUE ; i > 0 ; i--)
instead:
for(int i = 0 ; i < MAX_VALUE; i++)
| Is This Answer Correct ? | 7 Yes | 7 No |
Post New Answer View All Answers
Explain what are accessor methods?
What is functions syntax in c++?
What is a virtual destructor? Explain the use of it?
What are the advantages of using pointers in a program?
What do you mean by public protected and private in c++?
Explain what is oop?
What is iostream in c++ used for?
What is the outcome of cout< a) 16 b) 17 c) 16.5
Is c++ a float?
What are namespaces in c++?
What sorting algorithm does c++ use?
I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.
Can we use pointers in c++?
Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.
What is a float in c++?