fork(3) download
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. using namespace std;
  6.  
  7. class book
  8. {
  9. char bookname[20];
  10. char isbn[20];
  11. char author[20];
  12. char category[20];
  13. float price;
  14. int noc;
  15.  
  16. public:
  17.  
  18. void accept()
  19. {
  20.  
  21. cout<<"Enter book name :- \n";
  22. gets(bookname);
  23. cout<<"Enter isbn no of the book:- \n";
  24. gets(isbn);
  25. cout<<"Enter authour name:- \n";
  26. gets(author);
  27. cout<<"Enter category of book:- \n";
  28. gets(category);
  29. cout<<"Enter price of the book :- \n";
  30. cin>>price;
  31. cout<<"Enter no of copies of book available in the library :- \n";
  32. cin>>noc;
  33. }
  34.  
  35. void display()
  36. {
  37. puts(bookname)<<endl;
  38. puts(isbn)<<endl;
  39. puts(author)<<endl;
  40. puts(category)<<endl;
  41. cout<<price<<endl;
  42. cout<<noc<<endl;
  43. }
  44.  
  45. }b[5];
  46.  
  47. int main()
  48. {
  49. for(int i=0;i<5;++i)
  50. {
  51. b[i].accept();
  52. }
  53.  
  54. void issue()
  55. {
  56. int flag=0;
  57. char booksearch[20];
  58. cout<<"Enter name of book member wants to issue :- \n"
  59. gets(booksearch);
  60. for(i=0;i<5;++i)
  61. {
  62. flag=strcmp(booksearch,b[i].bookname)
  63. }
  64.  
  65. }
  66.  
  67. if(flag==1)
  68. {
  69. b[i].display();
  70. b[i].issue();
  71. }
  72. getch();
  73. return 0;
  74. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function 'void book::accept()':
prog.cpp:22:14: error: 'gets' was not declared in this scope
 gets(bookname);
              ^
prog.cpp: In member function 'void book::display()':
prog.cpp:37:17: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
 puts(bookname)<<endl;
                 ^
prog.cpp:38:13: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
 puts(isbn)<<endl;
             ^
prog.cpp:39:15: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
 puts(author)<<endl;
               ^
prog.cpp:40:17: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
 puts(category)<<endl;
                 ^
prog.cpp: In function 'int main()':
prog.cpp:55:1: error: a function-definition is not allowed here before '{' token
 {
 ^
prog.cpp:74:2: error: expected '}' at end of input
  }
  ^
stdout
Standard output is empty