Record Detail

Compile Error

/in/square.cpp: In function 'std::vector<int> square_sort(std::vector<int>&)':
/in/square.cpp:12:21: error: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
  int size_A = A.size();
               ~~~~~~^~
/in/square.cpp:16:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
   for (int i = 0; i < A.size(); i++)
                   ~~^~~~~~~~~~
/in/square.cpp:24:25: error: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
   for (int i = A.size() - 1; i != 0; i--)
                ~~~~~~~~~^~~
/in/square.cpp:30:22: error: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
  int size = A.size() - 1;
             ~~~~~~~~~^~~
/in/square.cpp:31:37: error: conversion to 'int' from 'std::vector<int>::size_type {aka long unsigned int}' may alter its value [-Werror=conversion]
  for (int left = 0, right = A.size()-1; left <= right; size--)
                             ~~~~~~~~^~
/in/square.cpp:12:6: error: unused variable 'size_A' [-Werror=unused-variable]
  int size_A = A.size();
      ^~~~~~
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Homework 1
Language
C++
Submit At
2021-09-25 16:54:04
Judged At
2021-09-25 16:54:04
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes