Dev c++ expected `;' before "to", expected `)' before ';' token -
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int size = 10; int numbers[size]; int i; int j; int temp; for((i = 0) (size - 2)) { for((j = 0) (size - 2)) { if(numbers[j] < numbers[j + 1]) { temp = numbers[j] numbers[j] = numbers[j+1] numbers[j+1] = temp } } } cout << "sorted list"; cout << "==========="; for((i = 0) (size - 1)) { cout << "number ", + 1, ": ", numbers[i] } system("pause"); return exit_success; }
i keep getting:
line 18 & 34: expected
;' before "to" line 32: expected
)' before ';' token
i can't figure out why. appreciated!
you have missed ;
in code (and few others). try version:
using namespace std; int main(int argc, char *argv[]) { int size = 10; int numbers[size]; int temp; for(int = 0; i< size - 2; i++) { for(int j = 0; j < size - 2; j++) { if(numbers[j] < numbers[j + 1]) { temp = numbers[j]; numbers[j] = numbers[j+1]; numbers[j+1] = temp; } } } cout << "sorted list"; cout << "==========="; for(int = 0; < size - 1; i++) { cout << "number ", + 1, ": ", numbers[i]; } system("pause"); return exit_success; }
please consider should initialize numbers
.
Comments
Post a Comment