My code is not working on Codeblocks?
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[]={1,6,6.1,3,4};
int l=sizeof(a)/sizeof(int);
int key;
cin>>key;
auto it =find(a,a+l,key);
cout<<it<<endl;
return 0;
}
My code is not working on Codeblocks?
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[]={1,6,6.1,3,4};
int l=sizeof(a)/sizeof(int);
int key;
cin>>key;
auto it =find(a,a+l,key);
cout<<it<<endl;
return 0;
}
hi u have inserted one float value in the int array
update it to int value or change the array to float one
it will give u address of position of element
Even after entering all elements in integer it is not working. Error that is coming is ‘it’ does not name a type.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a[] = {1, 6, 6, 3, 4};
int l = sizeof(a) / sizeof(int);
int key;
cin >> key;
auto it = find(a, a + l, key);
cout << *it << endl;return 0;}
this code works fine for me
you are running the program in codeblocks or something else?
Nope i get the value
Which compiler you are using Codeblocks or something different?
i used both ide.codingblocks & previously i was using vs code
ok…btw i was running it on Code blocks(in my system) and in ide of Coding Blocks it is running fine.
okay now is it solved?
yes it is solved.Thanks for the help