I am writing a program that acts like a shell. I used the System() function to compute the commands, however, I realized that exit and cd do not work. I figured out how to make my own exit, however, I cannot figure out how to get cd to work...if anyone could help that'd be great, I appreciate it in advance....here's my code...
Code:#include <iostream> #include <stdlib.h> #include <string> void main() { char cmd[100] = " "; cout << "Please enter command: "; cin.getline(cmd, 100); while (strcmp (cmd, "exit") !=0) { system (cmd); cout << "Please enter command: "; cin.getline(cmd,100); } exit(1); }