MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

GeeksForGeeks/Rotate_by_90_degrees/Solution.cpp:42–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42int main()
43{
44 int t;
45 cin>>t; //Inputting the number of test cases
46 while(t--)
47 {
48 int n;
49 cin>>n; //Inputting the size of the matrix
50 vector<vector<int> > matrix(n); //Initializing a 2 dimensional vector of size n
51
52 //Initializing the 2 dimensional vector with the elements entered
53 for(int i=0; i<n; i++)
54 {
55 matrix[i].resize(n);
56 for(int j=0; j<n; j++)
57 cin>>matrix[i][j];//Entering the elements of the vector
58 }
59 rotate(matrix);//Calling the function to rotate the matrix by 90 degrees
60
61 //Printing the final rotated matrix
62 for (int i = 0; i < n; ++i)
63 {
64 for(int j=0; j<n; j++)
65 cout<<matrix[i][j]<<" ";
66 cout<<"\n";
67 }
68 }
69 return 0;
70}

Callers

nothing calls this directly

Calls 1

rotateFunction · 0.70

Tested by

no test coverage detected