online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> using namespace std; int main() { int data[] = {32, 30, 12, 60, 50, 5, 90, 9}; int datasize = sizeof(data); int key,key1,key2,number,ans=0; int numdata=datasize/sizeof(int); cout<<"what two subsequent element do you want to find in the array? : "; cin>>key1>>key2; for (int i = 0; i < numdata-1; i++) //need to use numdata-1 because since max index is 7 but in line 94 theres i+1 which leads to element 9 or index 8 and theres no element 9 { int num = key1; int num1 = key2; if (data[i] == num) { if (data[i+1] == num1) { cout<<"Yes, those number is in the array subsequently"<<endl; break; } else { cout<<"Nope, those number is not in the array subsequently"<<endl; } } } int *pointer = NULL; cout<<"How Many Elements you want to find? : "; cin>>number; pointer = new int[number]; int temp; for(int j=0; j<number; j++ ) { cout<<"What are the elements? : "<<j+1<<")"; cin>>temp; *(pointer+j)= temp; } cout<<"the element u have entered are"<<endl; for(int j=0; j<number; j++ ) { cout<<*(pointer+j)<<","; } delete []pointer; return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue