An array of size 5X5 is given to us. The elements from 1 to
25 are to be inserted in the array, such that starting from
a particular position for an element i, the next element
i+1can be inserted only at the mentioned positions (u,v),
and if these all positions are occupied then it returns
giving a count of how many positions have been occupied in
the array:
(u,v) = (x+/-3 , y)
(u,v) = (x , y+/-3)
(u,v) = (x+/-2 , y+/-2).

Example: if the starting element is 1 with the given
positions (1,2), then next element 2 can be placed at any
one of the positions marked with *.
_ _ _ _ _
1 _ _ _ *
_ _ _ _ _
_ _ * _ _
* _ _ _ _


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More C++ Code Interview Questions

What output does this program generate as shown? Why? class A { A() { cout << "A::A()" << endl; } ~A() { cout << "A::~A()" << endl; throw "A::exception"; } }; class B { B() { cout << "B::B()" << endl; throw "B::exception"; } ~B() { cout << "B::~B()"; } }; int main(int, char**) { try { cout << "Entering try...catch block" << endl; A objectA; B objectB; cout << "Exiting try...catch block" << endl; } catch (char* ex) { cout << ex << endl; } return 0; }

0 Answers  


what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }

0 Answers  


How can I Draw an ellipse in 3d space and color it by using graph3d?

0 Answers  


How to Split Strings with Regex in Managed C++ Applications?

0 Answers   Microsoft,


Write a program using two-dimensional arrays that determines the highest and lowest of the 12 input values. Example: Enter 12 numbers: 13 15 20 13 35 40 16 18 20 18 20 14 highest: 40 lowest: 13

1 Answers  






An array of size 5X5 is given to us. The elements from 1 to 25 are to be inserted in the array, such that starting from a particular position for an element i, the next element i+1can be inserted only at the mentioned positions (u,v), and if these all positions are occupied then it returns giving a count of how many positions have been occupied in the array: (u,v) = (x+/-3 , y) (u,v) = (x , y+/-3) (u,v) = (x+/-2 , y+/-2). Example: if the starting element is 1 with the given positions (1,2), then next element 2 can be placed at any one of the positions marked with *. _ _ _ _ _ 1 _ _ _ * _ _ _ _ _ _ _ * _ _ * _ _ _ _

0 Answers   Nagarro,


write a program that reverses the input number of n.Formulate an equation to come up with the answer.

0 Answers   Satyam,


Assume in University Every student in university as entity, prepare a class for student that store the roll no, name, dob of student, and make funtion of deletion, manipulation, addition of student record.

0 Answers  


Code for Method of Handling Factorials of Any Size?

0 Answers  


using friend function find the maximum number from given two numbers from two different classes.write all necessary functions and constructor for the classes.

1 Answers   TCS,


Ask the user to input three positive integers M, N and q. Make the 2 dimensional array of integers with size MxN, where all the elements of I (I = 1,…,M) line will be members of geometrical progression with first element equal to the number of line (I) and denominator q.

0 Answers  


how to write a program that opens a file and display in reverse order?

0 Answers   SMC,


Categories