fork download
  1. /*
  2.  * mapphonebook.cpp
  3.  *
  4.  * Created on: Mar 19, 2012
  5.  * Author: cskim
  6.  */
  7. #include <iostream>
  8. #include <string>
  9. #include <map>
  10.  
  11. #include <string>
  12. using namespace std;
  13.  
  14. class Entry {
  15. public:
  16. Entry(){
  17. phoneName = "";
  18. phoneNumber = -1;
  19. }
  20. Entry(string s, int n) {
  21. phoneName = s;
  22. phoneNumber = n;
  23. }
  24. string phoneName;
  25. int phoneNumber;
  26. };
  27. #ifndef MAPPHONEBOOK_H_
  28. #define MAPPHONEBOOK_H_
  29.  
  30. int findMap(string fname);
  31. string find_Map(int number);
  32. bool insertMap(string name, int number);
  33. bool removeMap(string name);
  34. bool updateMap(string name, int number);
  35. void listAllMap();
  36.  
  37.  
  38.  
  39. #endif /* MAPPHONEBOOK_H_ */
  40.  
  41.  
  42. using namespace std;
  43. #include "Entry.h"
  44. #include "mapphonebook.h"
  45.  
  46. typedef map<string, int>::const_iterator CMIter;
  47. typedef map<string, int>::iterator MIter;
  48.  
  49. map<string, int> mapPhoneBook;
  50.  
  51. int findMap(string fname){
  52. return mapPhoneBook[fname];
  53. }
  54. string find_Map(int number){
  55.  
  56.  
  57. }
  58. bool insertMap(string name, int number){
  59. mapPhoneBook[name] = number;
  60. return true;
  61. }
  62. bool removeMap(string name){
  63. MIter iter = mapPhoneBook.find(name);
  64. if (iter == mapPhoneBook.end())
  65. return false;
  66. mapPhoneBook.erase(iter);
  67. return true;
  68. }
  69. bool updateMap(string name, int number){
  70. mapPhoneBook[name] = number;
  71. return true;
  72. }
  73. void listAllMap(){
  74. for (CMIter i=mapPhoneBook.begin(); i!=mapPhoneBook.end(); i++) {
  75. cout << i->first << " " << i->second << endl;
  76. }
  77. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:43:19: fatal error: Entry.h: No such file or directory
 #include "Entry.h"
                   ^
compilation terminated.
stdout
Standard output is empty