Have you ever worked with bits/stdc++.h? Could you explain to me this program? And why can't it be compiled? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Have you ever worked with bits/stdc++.h? Could you explain to me this program? And why can't it be compiled?

#include<bits/stdc++.h> using namespace std; struct node { string sourceIP; string destinationIP; string data; struct node *next; }; void searchPacket(struct node x) { if(x.sourceIP[0]=='0' && x.sourceIP[1]=='0' && x.sourceIP[2]=='0') cout<<"Source IP is suspicious."; if(x.destinationIP[0]=='0' && x.destinationIP[1]=='0' && x.destinationIP[2]=='0') cout<<"Destination IP is suspicious."; } bool cyphertext(struct node x) { for(int i=0;i<8;i++) x.data[i] -= 1; if(strncmp(x.data,"JOHN JAY",8)) cout<<"The data contains JOHN JAY"; } int main() { node abc[2][3]; for(int i=0;i<2;i++) for(int j=0;j<3<j++) { cin>>abc[i][j].sourceIP; cin>>abc[i][j].destinationIP; cin>>abc[i][j].data; if(j==2) abc[i][j].next = NULL; else abc[i][j].next = abc[i][j+1]; } return 0; }

1st May 2017, 3:51 AM
Anastasia
5 Answers
+ 7
https://code.sololearn.com/co8vZnCO3bk4/?ref=app take a look at this code. if you got any questions just comment on the code and Ill reply within seconds
1st May 2017, 4:27 AM
chris
chris - avatar
+ 7
I never use #include<bits/stdc++.h> I didn't even know that existed but I have used #include <bitset>
1st May 2017, 4:29 AM
chris
chris - avatar
+ 1
That header during compilation time will fetch all necessary header files required for the program .You don't have to include all necessary header files in your program.Instead bits/stdc++ does that work.
1st May 2017, 4:37 AM
Nantha
Nantha - avatar
+ 1
When i run the program, there is an issue with a header.
2nd May 2017, 7:54 PM
Anastasia
0
It depends on the type of compiler you are using .It works in Dev c++ but does not in the default compiler for Linux.Compiler dependent to be precise.
3rd May 2017, 2:52 AM
Nantha
Nantha - avatar