"error C2181: illegal else without matching if" whats' this error,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,?
#include "stdafx.h" #include <iostream> using namespace std; void fill(int a[], int length) { for (int i = 0; i < length; i++) { cout << "Element #" << i+1 << endl; cin >> a[i]; } } void print(int a[], int length) { cout << "A R R A Y Of 10 Elements .." << endl; for (int j = 0; j < length; j++) { cout << a[j] << " | "; } } void find_key(int a[], int length) { int key; cout << "Find The Number: "; cin >> key; bool found = false; for (int i = 0; i < length; i++) { if (key == a[i]) { found = true; } if (found) { cout << "K E Y Present" << endl; else { cout << "K E Y Absent" << endl; } } } } int main() { const int length = 10; int label[length]; fill(label, length); print(label, length); find_key(label, length); system("pause"); return 0; }
if (found) { cout << "K E Y Present" << endl; >>>> else
}
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)