divyang4481 / mipt-hw

Automatically exported from code.google.com/p/mipt-hw
0 stars 0 forks source link

task09 Topological Sort (Анастасьев) #223

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
anastasyev_daniil/task09_TopologicalSort/

Original issue reported on code.google.com by dan.anas...@gmail.com on 28 Apr 2013 at 3:26

GoogleCodeExporter commented 9 years ago
0. Warnings:
TopSort.cpp: In function 'void DFSVisit(std::vector<std::vector<TNode*> >&, 
int, int&, std::list<TNode*>&)':
TopSort.cpp:22:32: warning: comparison between signed and unsigned integer 
expressions [-Wsign-compare]
TopSort.cpp: In function 'void TopSort(std::vector<std::vector<TNode*> >&, 
std::list<TNode*>&)':
TopSort.cpp:38:29: warning: comparison between signed and unsigned integer 
expressions [-Wsign-compare]
TopSort.cpp:45:29: warning: comparison between signed and unsigned integer 
expressions [-Wsign-compare]

1. Решение верное, но ответ на данные задачи 
- неверный.

Original comment by aivyu...@gmail.com on 28 Apr 2013 at 8:20

GoogleCodeExporter commented 9 years ago

Original comment by dan.anas...@gmail.com on 4 May 2013 at 9:55

GoogleCodeExporter commented 9 years ago
Warnings:
TopSort.cpp: In function ‘int main()’:
TopSort.cpp:83: warning: format ‘%d’ expects type ‘int*’, but argument 
3 has type ‘size_t*’
TopSort.cpp:83: warning: format ‘%d’ expects type ‘int*’, but argument 
4 has type ‘size_t*’
TopSort.cpp:83: warning: format ‘%d’ expects type ‘int*’, but argument 
3 has type ‘size_t*’
TopSort.cpp:83: warning: format ‘%d’ expects type ‘int*’, but argument 
4 has type ‘size_t*’
TopSort.cpp:85: error: ‘N’ cannot appear in a constant-expression
TopSort.cpp:85: error: a function call cannot appear in a constant-expression
TopSort.cpp:85: error: ‘>>’ should be ‘> >’ within a nested template 
argument list
TopSort.cpp:100: warning: format ‘%d’ expects type ‘int*’, but argument 
3 has type ‘size_t*’
TopSort.cpp:100: warning: format ‘%d’ expects type ‘int*’, but argument 
4 has type ‘size_t*’
TopSort.cpp:100: warning: format ‘%d’ expects type ‘int*’, but argument 
3 has type ‘size_t*’
TopSort.cpp:100: warning: format ‘%d’ expects type ‘int*’, but argument 
4 has type ‘size_t*’

Вы вообще смотрите на предупреждения 
компилятора, прежде чем сдавать задачу?

Запускаю Ваше приложение, падает:
Segmentation fault: 11

Original comment by aivyu...@gmail.com on 10 May 2013 at 8:45

GoogleCodeExporter commented 9 years ago
Visual Studio 2010 при EnableAllWarnings (/Wall) из 
относящегося ко мне выводит только:
topsort.cpp(81): warning C4996: 'fopen': This function or variable may be 
unsafe. Consider using fopen_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
stdio.h(234) : see declaration of 'fopen'
topsort.cpp(83): warning C4996: 'fscanf': This function or variable may be 
unsafe. Consider using fscanf_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
stdio.h(253) : see declaration of 'fscanf'
topsort.cpp(100): warning C4996: 'fscanf': This function or variable may be 
unsafe. Consider using fscanf_s instead. To disable deprecation, use 
_CRT_SECURE_NO_WARNINGS. See online help for details.
stdio.h(253) : see declaration of 'fscanf'

Не понимаю смысла error'ов:
TopSort.cpp:85: error: ‘N’ cannot appear in a constant-expression
TopSort.cpp:85: error: a function call cannot appear in a constant-expression

N разве не относится к конструктору вектора:
explicit vector (size_type n, const value_type& val = value_type(),
                 const allocator_type& alloc = allocator_type());
  в котором size_type не имеет константности?

Остальное сейчас исправлю.

Original comment by dan.anas...@gmail.com on 10 May 2013 at 9:04

GoogleCodeExporter commented 9 years ago
Думаю, что проблема в ">>". 
В С++2003 этот символ воспринимается как 
сдвиг, а не часть объявления шаблона. 
ПОпробуйте поставить пробел.

Original comment by aivyu...@gmail.com on 10 May 2013 at 11:17

GoogleCodeExporter commented 9 years ago

Original comment by dan.anas...@gmail.com on 15 May 2013 at 2:00

GoogleCodeExporter commented 9 years ago
Решение принято.

Original comment by aivyu...@gmail.com on 19 May 2013 at 11:42