|
1 |
| -# a makefile example using multiple libraries and include |
2 |
| -# |
3 |
| - |
4 |
| -# |
5 |
| -# $@ The name of the EXEC file (the one before the colon) |
6 |
| -# $< The name of the first (or only) prerequisite file (the first one after the colon) |
7 |
| -# $^ The names of all the prerequisite files (space separated) |
8 |
| -# |
9 |
| -CC = g++ |
10 |
| -LIBDIR = ../../lib |
11 |
| -INCDIR = ../../include |
12 |
| -CCFLAGS = -std=c++11 -Wall -g |
13 |
| -#CCFLAGS += -DDEBUG # uncomment for debugging |
14 |
| -ifeq ($(OS),Windows_NT) |
15 |
| - LDFLAGS = -L$(LIBDIR) -lnowic -lsort -lrand |
16 |
| -else |
17 |
| - LDFLAGS = -L$(LIBDIR) -lnowic_mac -lsort_mac -lrand_mac |
18 |
| -endif |
19 |
| - |
20 |
| -$(info ) |
21 |
| -$(info To use main() in profiling.cpp or profile.cpp as a standalone,) |
22 |
| -$(info turn on, set #if 1, just above main() in profiling.cpp or profile.cpp) |
23 |
| -$(info ) |
24 |
| -SRC1 = profiling.cpp |
25 |
| -OBJ1 = $(SRC1:.cpp=.o) |
26 |
| -EXE1 = profiling |
27 |
| - |
28 |
| -# rule for link |
29 |
| -all: $(EXE1) |
30 |
| -$(EXE1): $(OBJ1) |
31 |
| - $(CC) -o $@ $^ $(LDFLAGS) |
32 |
| - |
33 |
| -$(EXE2): $(OBJ2) |
34 |
| - $(CC) -o $@ $^ $(LDFLAGS) |
35 |
| - |
36 |
| -# rule for compilation |
37 |
| -%.o: %.cpp |
38 |
| - $(CC) $(CCFLAGS) -c -I$(INCDIR) $< |
39 |
| - |
40 |
| -.PHONY: all clean install |
41 |
| -clean: |
42 |
| - rm -f *.o *.exe $(OBJ1) $(EXE1) |
43 |
| - |
44 |
| -TARGET_PATH = ..\\..\\..\\nowic\\psets\\pset4 |
45 |
| -install: |
46 |
| -ifeq ($(OS),Windows_NT) |
47 |
| - mkdir -p ./deliverable && \ |
48 |
| - cp profiling.pdf profilingENG.pdf makefile $(EXE1).exe ./deliverable |
49 |
| - cp profiling.cpp ./deliverable |
50 |
| - mkdir -p $(TARGET_PATH) && cp -v deliverable/* $(TARGET_PATH) |
51 |
| - xcopy .vscode $(TARGET_PATH)\.vscode //E //H //K //Y //I |
52 |
| -else |
53 |
| - cp $(EXE1) ./deliverable |
54 |
| - cp -v $(EXE1) $(TARGET_PATH) |
55 |
| -endif |
56 |
| - |
| 1 | +Node* remove(Node* head, int key) { |
| 2 | + node* pre = head, |
| 3 | + node* zap = head->next; |
| 4 | + while(zap->data!= key) { |
| 5 | + pre = zap; |
| 6 | + zap = zap->next; |
| 7 | + } |
| 8 | + pre->next = zap->next; |
| 9 | + delete zap; |
| 10 | + return head; |
| 11 | +} |
0 commit comments