├── README.md ├── Solutions ├── Hello ├── Exercise5 ├── Exercise6 ├── Exercise8 ├── Exercise4_2_3 ├── helloWorld.cpp ├── exercise4_2.cpp ├── exercise5.cpp ├── exercise6.cpp └── exercise8.cpp ├── .gitignore └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # pratical-cpp- 2 | Solutions to Steve Oualline's Book 3 | -------------------------------------------------------------------------------- /Solutions/Hello: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/D-K-E/pratical-cpp-/master/Solutions/Hello -------------------------------------------------------------------------------- /Solutions/Exercise5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/D-K-E/pratical-cpp-/master/Solutions/Exercise5 -------------------------------------------------------------------------------- /Solutions/Exercise6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/D-K-E/pratical-cpp-/master/Solutions/Exercise6 -------------------------------------------------------------------------------- /Solutions/Exercise8: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/D-K-E/pratical-cpp-/master/Solutions/Exercise8 -------------------------------------------------------------------------------- /Solutions/Exercise4_2_3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/D-K-E/pratical-cpp-/master/Solutions/Exercise4_2_3 -------------------------------------------------------------------------------- /Solutions/helloWorld.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | std::cout << "Hello World\n"; 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /Solutions/exercise4_2.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Calculate the perimeter of a rectangle 3 | and Write and E block 4 | 5 | Author: Kaan Eraslan 6 | 7 | Purpose: Title says it all 8 | 9 | Usage: Run the program. 10 | */ 11 | 12 | // Library Declaration 13 | 14 | #include 15 | 16 | // End of Library Declaration 17 | 18 | // Variable Declaration 19 | 20 | int width; // Width of the Rectangle in inches 21 | int height; // Height of the rectangle in inches 22 | int perimeter; // Perimeter of the rectangle 23 | 24 | // End of Variable Declaration 25 | 26 | // print E 27 | int main( ) 28 | { 29 | std::cout << "*" << "*" << "*\n" << "*\n" << "*" << "*" << "*\n" << "*\n" << "*" << "*" << "*\n" << "E, done.\n"; 30 | width = 3; 31 | height = 5; 32 | perimeter = (3+5)* 2; 33 | std::cout << "Here is the perimeter of the rectangle: " << perimeter << ".\n"; 34 | return (0); 35 | } 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 DKE 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Solutions/exercise5.cpp: -------------------------------------------------------------------------------- 1 | /* Solutions to Exercise 5 2 | 3 | Author: Kaan Eraslan 4 | 5 | Purpose: Convert integers, hours, minutes, perimeters, kilometers, 6 | 7 | Usage: Run the program. Enter what's demanded. Withness the magic. 8 | 9 | */ 10 | 11 | // Package Declaration 12 | #include 13 | #include 14 | 15 | // End of Package Declaration 16 | 17 | // variable Declaration 18 | 19 | float fahrenheit; // Converted from Celsius 20 | int celsius; // The user input celsius 21 | int radius; // radius for calculating sphere volume 22 | const float PI = 3.1415926; // Pi value 23 | float volume; // for storing the sphere volume 24 | int width; // width for the rectangle 25 | int height; // height for the rectangle 26 | int perimeter; // perimeter of the rectangle 27 | int kilometer; // km to convert to miles 28 | float mile; // miles converted from km 29 | int hour; // hour to convert minutes 30 | int minute; // to add to the converted minutes from hour 31 | int total_minutes; // total minutes after conversion 32 | 33 | 34 | // End of variable Declaration 35 | 36 | int main() 37 | { 38 | std::cout << "Enter heat in Celsius: "; 39 | std::cin >> celsius; 40 | fahrenheit = 9/5 * celsius + 32; 41 | std::cout << "Heat in Fahrenheit: " << fahrenheit << "\n"; 42 | std::cout << "Enter the radius for the sphere: "; 43 | std::cin >> radius; 44 | volume = (radius*radius*radius) * 3/4 * PI; 45 | std::cout << "Volume of the sphere: " << volume << "\n"; 46 | std::cout << "For the rectangle perimeter, enter width: "; 47 | std::cin >> width; 48 | std::cout << "Enter height: "; 49 | std::cin >> height; 50 | perimeter = 2*(width + height); 51 | std::cout << "Here is the perimeter: " << perimeter << "\n"; 52 | std::cout << "Enter the number of kilometers: "; 53 | std::cin >> kilometer; 54 | mile = kilometer* 0.6213712; 55 | std::cout << "Here is the miles version: " << mile << "\n"; 56 | std::cout << "Enter hours: "; 57 | std::cin >> hour; 58 | std::cout << "Enter minutes: "; 59 | std::cin >> minute; 60 | total_minutes = (hour * 60) + minute; 61 | std::cout << "Total minutes: " << total_minutes << "\n"; 62 | std::cout << "Enter Total minutes: "; 63 | std::cin >> total_minutes; 64 | hour = total_minutes / 60; 65 | minute = total_minutes % 60; 66 | std::cout << "That makes: " << hour << " hours, and " << minute << " minutes.\n"; 67 | return (0); 68 | } 69 | -------------------------------------------------------------------------------- /Solutions/exercise6.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Exercise 6 Solutions 3 | 4 | Author: Kaan Eraslan 5 | 6 | Purpose: If statements conditions, etc. 7 | 8 | Usage: Run Program. Provide the numbers in the instructions. 9 | 10 | */ 11 | 12 | // Package declaration 13 | 14 | #include 15 | #include 16 | 17 | // end of Package declaration 18 | 19 | // Variable Declaration 20 | 21 | // 6.1 ----------- 22 | int student_score; // Score provided by the teacher 23 | // 6.2 ----------- 24 | int last_digit; // Last digit of the score provided by the teacher 25 | char digit_mark; // + or - according to the digit 26 | // 6.3 ---------- 27 | int given_money; // money less than 1 dollar provided by the user 28 | int remaining_money; // money remainder after divisions in pennies 29 | int quarters; // money unit 30 | int dimes; // money unit 31 | int nickels; // money unit 32 | // 6.4 ------------ 33 | int year; // user provided year 34 | // 6.5 ------------ 35 | int hours; // user provided worked hours 36 | int wage_hourly; // hourly wage of the employee 37 | int over_time_hours; // hours that are above 40 38 | int total_pay; // total amount to be paid to employee 39 | 40 | 41 | 42 | 43 | 44 | int main() 45 | { 46 | std::cout << "What did the student get? "; 47 | std::cin >> student_score; 48 | // exercise 6.1 conditions 49 | if (student_score <= 60){ 50 | std::cout << "F.\n"; 51 | } 52 | if ((student_score > 60) && (student_score <= 70)){ 53 | std::cout << "D.\n"; 54 | } 55 | if ((student_score > 70) && (student_score <= 80)){ 56 | std::cout << "C.\n"; 57 | } 58 | if ((student_score > 80) && (student_score <= 90)){ 59 | std::cout << "B.\n"; 60 | } 61 | if ((student_score > 90) && (student_score <= 100)){ 62 | std::cout << "A.\n"; 63 | } 64 | // exercise 6.2 modification 65 | std::cout << "What did the student get? "; 66 | std::cin >> student_score; 67 | last_digit = student_score % 10; // gives the last digit 68 | if ((last_digit >= 1) && (last_digit <= 3)){ 69 | digit_mark = '-'; 70 | } 71 | if ((last_digit >= 4) && (last_digit <= 7)){ 72 | digit_mark = ' '; 73 | } 74 | if (((last_digit >= 8) && (last_digit <= 9)) || (last_digit == 0)){ 75 | digit_mark = '+'; 76 | } 77 | if (student_score <= 60){ 78 | std::cout << "F.\n"; 79 | } 80 | if ((student_score > 60) && (student_score <= 70)){ 81 | std::cout << "D"<< digit_mark << ".\n"; 82 | } 83 | if ((student_score > 70) && (student_score <= 80)){ 84 | std::cout << "C" << digit_mark << ".\n"; 85 | } 86 | if ((student_score > 80) && (student_score <= 90)){ 87 | std::cout << "B" << digit_mark << ".\n"; 88 | } 89 | if ((student_score > 90) && (student_score <= 100)){ 90 | std::cout << "A" << digit_mark << ".\n"; 91 | } 92 | // exercise 6.3 93 | std::cout << "Enter money amount less than 1 dollar: "; 94 | std::cin >> given_money; 95 | quarters = 0; 96 | dimes = 0; 97 | nickels = 0; 98 | quarters = given_money / 25; 99 | remaining_money = given_money % 25; 100 | if (remaining_money >= 10){ 101 | dimes = remaining_money / 10; 102 | remaining_money = remaining_money % 10; 103 | } 104 | if (remaining_money >= 5){ 105 | nickels = remaining_money / 5; 106 | remaining_money = remaining_money % 5; 107 | } 108 | std::cout << "You have, " << quarters << " quarters, " << dimes << " dimes, " << nickels << " nickles, " << remaining_money << " pennies.\n"; 109 | // exercise 6.4 110 | std::cout << "Enter year: "; 111 | std::cin >> year; 112 | if ((year % 4 == 0) && (year % 100 != 0) && (year % 400 == 0)){ 113 | std::cout << "This is a leap year.\n"; 114 | } 115 | // exercise 6.5 116 | std::cout << "Enter worked hours: "; 117 | std::cin >> hours; 118 | wage_hourly = 10; 119 | over_time_hours = 0; 120 | total_pay = 0; 121 | if (hours > 40){ 122 | over_time_hours = hours - 40; 123 | total_pay = (40 * wage_hourly) + ((2*over_time_hours)*10); 124 | } 125 | else 126 | total_pay = wage_hourly * hours; 127 | std::cout << "Total Pay: " << total_pay << ".\n"; 128 | // END 129 | return (0); 130 | } 131 | -------------------------------------------------------------------------------- /Solutions/exercise8.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Solutions to Exercise 8 3 | 4 | Author: Kaan Eraslan 5 | 6 | Usage: Run program. Follow the instructions on the command line. 7 | 8 | */ 9 | // Package Declaration 10 | #include 11 | #include 12 | #include 13 | #include 14 | // end of Package Declaration 15 | 16 | // Variable Declaration 17 | 18 | // 8.1 19 | 20 | std::string plus_dash_plus; // reproduces the +--+ combination 21 | std::string vertical_line; // reproduces | 22 | int counter; // counter for while statements 23 | int counter2; // another counter for nested statements 24 | int counter3; // yet another counter for nested while statements 25 | 26 | // 8.2 27 | int total_resistance_number; // total number of resistance 28 | float numbers; // numbers after decimal points 29 | float total_resistance_value; // total value of the resistances 30 | float total_resistance; // resulting value of the calculations. 31 | // provided by the user 32 | // 8.3 33 | int number_of_numbers; /* total number of numbers 34 | that is going to be provided by the user */ 35 | float average_number; // number provided by the user 36 | // 8.4 37 | int top_multiplication_number; // upper bound for the multiplication table 38 | int result_multiplication; // result of the multiplication 39 | // 8.5 40 | std::string input_char; // input char entered by the user 41 | std::string vowels; // vowels 42 | std::string consonants; // consonant list 43 | std::size_t found; // found position of the searched string 44 | // 8.6 45 | std::string input_integers; // input integers entered by the user 46 | char int_char; // section of the input integer string. 47 | std::string output_str; // output string to be printed in terminal 48 | // 8.7 49 | 50 | 51 | 52 | // end of Variable Declaration 53 | 54 | int main() 55 | { 56 | // exercise 8.1 57 | plus_dash_plus = "+-----"; // this would be printed 58 | vertical_line = "| "; // this would be printed 59 | counter3 = 0; // this is a counter for the global operation 60 | // by the end of it, we shall have 8 vertical and horizontal grids 61 | while (counter3 <= 8){ 62 | counter = 0; // counter for the horizontal grid 63 | // 64 | while (counter <= 8){ 65 | std::cout << plus_dash_plus; 66 | counter += 1; 67 | } 68 | std::cout << "+\n"; // we add the last element of the grid 69 | counter2 = 0; // counter for vertical grids in the box 70 | while (counter2 <= 3){ 71 | counter = 0; // counter for placing the vertical grids on the below 72 | // the + signs of the horizontal grid 73 | while (counter <= 8){ 74 | std::cout << vertical_line; 75 | counter += 1; 76 | } 77 | std::cout << "|\n"; 78 | counter2 += 1; 79 | } 80 | counter3 += 1; 81 | } 82 | counter = 0; // counter for the last horizontal grid at the bottom. 83 | while (counter <= 8){ 84 | std::cout << plus_dash_plus; 85 | counter += 1; 86 | } 87 | std::cout << "+\n"; 88 | // exercise 8.1 ends 89 | // exercise 8.2 90 | std::cout << "Enter the total number of parallel resistance: "; 91 | std::cin >> total_resistance_number; 92 | // initializing the array with the provided input 93 | float parallel_resistance[total_resistance_number]; 94 | assert(total_resistance_number -1 < signed (sizeof( 95 | parallel_resistance 96 | )/sizeof( 97 | parallel_resistance[0] 98 | ) 99 | )); 100 | assert(total_resistance_number >= 0); 101 | counter = total_resistance_number - 1; 102 | counter2 = 0; 103 | while(counter2 <= counter){ 104 | std::cout << "Enter the value: "; 105 | std::cin >> parallel_resistance[counter2]; 106 | counter2 += 1; 107 | } 108 | counter2 = 0; 109 | total_resistance_value = 0; 110 | while(counter2 <= counter){ 111 | numbers = 1 / parallel_resistance[counter2]; 112 | total_resistance_value += numbers; 113 | counter2 += 1; 114 | } 115 | //total_resistance_value = std::floor(total_resistance_value * 100) / 100; 116 | total_resistance = 1 / total_resistance_value; 117 | std::cout << "Here is the the total resistance of all the parallel resistances: " 118 | << total_resistance << ".\n"; 119 | // exercise 8.2 ends 120 | std::cout << "Enter how many numbers you would be entering: "; 121 | std::cin >> number_of_numbers; 122 | int user_numbers[number_of_numbers]; // array for storing user input 123 | assert(number_of_numbers - 1 < signed (sizeof( 124 | user_numbers 125 | )/sizeof( user_numbers[0] 126 | )) 127 | ); 128 | counter = 0; 129 | while (counter < number_of_numbers){ 130 | std::cout << "Enter the number: "; 131 | std::cin >> user_numbers[counter]; 132 | counter += 1; 133 | } 134 | counter = 0; 135 | counter2 = 0; 136 | while (counter < number_of_numbers){ 137 | counter2 = counter2 + user_numbers[counter]; 138 | counter += 1; 139 | } 140 | std::cout << counter2 << "\n"; 141 | average_number = counter2 / number_of_numbers; 142 | std::cout << "Average of the numbers are: " << average_number << ".\n"; 143 | // exercise 8.3 ends 144 | std::cout << "Enter the upper bound for the multiplication table: "; 145 | std::cin >> top_multiplication_number; 146 | int multiplication_array[top_multiplication_number+1]; 147 | assert(top_multiplication_number < signed (sizeof(multiplication_array) / 148 | sizeof(multiplication_array[0])) 149 | ); 150 | counter = 0; 151 | while (counter <= top_multiplication_number){ 152 | multiplication_array[counter] = counter; 153 | counter += 1; 154 | } 155 | counter = 0; 156 | while (counter <= top_multiplication_number){ 157 | counter2 = 0; 158 | while (counter2 <= top_multiplication_number){ 159 | result_multiplication = multiplication_array[counter] * multiplication_array[counter2]; 160 | std::cout << counter 161 | << " x " 162 | << counter2 163 | << " = " 164 | << result_multiplication 165 | << "\n"; 166 | counter2 += 1; 167 | } 168 | counter += 1; 169 | } 170 | // exercise 8.4 ends 171 | std::cout << "Enter a character: "; 172 | std::cin >> input_char; 173 | vowels = "aeiouöüı"; 174 | consonants = "qwrtypğasdfghjklşzxcvbnmç"; 175 | found = vowels.find(input_char); 176 | if (found != std::string::npos){ 177 | std::cout << "You have entered a vowel\n"; 178 | } 179 | else{ 180 | found = consonants.find(input_char); 181 | if (found != std::string::npos){ 182 | std::cout << "You have entered a consonant\n"; 183 | } 184 | } 185 | // exercise 8.5 ends 186 | // 187 | std::cout << "Enter a number for converting into letters: "; 188 | std::cin >> input_integers; 189 | for(int unsigned counter2=0; counter2 < input_integers.length(); ++counter2){ 190 | int_char = input_integers.at(counter2); 191 | // Starting Switch 192 | switch (int_char) { 193 | case '0': 194 | output_str += "zero "; 195 | break; 196 | case '1': 197 | output_str += "one "; 198 | break; 199 | case '2': 200 | output_str += "two "; 201 | break; 202 | case '3': 203 | output_str += "three "; 204 | break; 205 | case '4': 206 | output_str += "four "; 207 | break; 208 | case '5': 209 | output_str += "five "; 210 | break; 211 | case '6': 212 | output_str += "six "; 213 | break; 214 | case '7': 215 | output_str += "seven "; 216 | break; 217 | case '8': 218 | output_str += "eight "; 219 | break; 220 | case '9': 221 | output_str += "nine "; 222 | break; 223 | } 224 | } 225 | std::cout << "Here are the numbers in string: " << output_str << "\n"; 226 | // Exercise 8.6 ends 227 | // 228 | std::cout << "Enter a number for converting into letters: "; 229 | std::cin >> input_integers; 230 | output_str = ""; 231 | if (input_integers.length() > 1){ 232 | if (input_integers == "11"){ 233 | output_str = "eleven"; 234 | } 235 | if (input_integers == "12"){ 236 | output_str = "twelve"; 237 | } 238 | if (input_integers == "13"){ 239 | output_str = "thirteen"; 240 | } 241 | if (input_integers == "14"){ 242 | output_str = "fourteen"; 243 | } 244 | if (input_integers == "15"){ 245 | output_str = "fifteen"; 246 | } 247 | if (input_integers == "16"){ 248 | output_str = "sixteen"; 249 | } 250 | if (input_integers == "17"){ 251 | output_str = "seventeen"; 252 | } 253 | if (input_integers == "18"){ 254 | output_str = "eighteen"; 255 | } 256 | if (input_integers == "19"){ 257 | output_str = "nineteen"; 258 | } 259 | if (input_integers == "20"){ 260 | output_str = "twenty"; 261 | } 262 | if (input_integers == "30"){ 263 | output_str = "thirty"; 264 | } 265 | if (input_integers == "40"){ 266 | output_str = "fourty"; 267 | } 268 | if (input_integers == "50"){ 269 | output_str = "fifthy"; 270 | } 271 | if (input_integers == "60"){ 272 | output_str = "sixty"; 273 | } 274 | if (input_integers == "70"){ 275 | output_str = "seventy"; 276 | } 277 | if (input_integers == "80"){ 278 | output_str = "eighty"; 279 | } 280 | if (input_integers == "90"){ 281 | output_str = "ninety"; 282 | } 283 | if (input_integers == "100"){ 284 | output_str = "hundered"; 285 | } 286 | } 287 | 288 | for(int unsigned counter2=0; counter2 < input_integers.length(); ++counter2){ 289 | if (input_integers.length() == 1){ 290 | int_char = input_integers.at(counter2); 291 | // Starting Switch 292 | switch (int_char) { 293 | case '0': 294 | output_str += "zero "; 295 | break; 296 | case '1': 297 | output_str += "one "; 298 | break; 299 | case '2': 300 | output_str += "two "; 301 | break; 302 | case '3': 303 | output_str += "three "; 304 | break; 305 | case '4': 306 | output_str += "four "; 307 | break; 308 | case '5': 309 | output_str += "five "; 310 | break; 311 | case '6': 312 | output_str += "six "; 313 | break; 314 | case '7': 315 | output_str += "seven "; 316 | break; 317 | case '8': 318 | output_str += "eight "; 319 | break; 320 | case '9': 321 | output_str += "nine "; 322 | break; 323 | } 324 | } 325 | if ((counter2 == 0) 326 | and (input_integers.length() > 1) 327 | and (input_integers != "20") 328 | and (input_integers != "30") 329 | and (input_integers != "40") 330 | and (input_integers != "50") 331 | and (input_integers != "60") 332 | and (input_integers != "70") 333 | and (input_integers != "80") 334 | and (input_integers != "90") 335 | and (input_integers != "100") 336 | ){ 337 | int_char = input_integers.at(counter2); 338 | // Starting Switch 339 | switch (int_char) { 340 | case '2': 341 | output_str += "twenty "; 342 | break; 343 | case '3': 344 | output_str += "thirty "; 345 | break; 346 | case '4': 347 | output_str += "fourty "; 348 | break; 349 | case '5': 350 | output_str += "fifthy "; 351 | break; 352 | case '6': 353 | output_str += "sixty "; 354 | break; 355 | case '7': 356 | output_str += "seventy "; 357 | break; 358 | case '8': 359 | output_str += "eighty "; 360 | break; 361 | case '9': 362 | output_str += "ninety "; 363 | break; 364 | } 365 | } 366 | else{ 367 | if (counter2 != 0){ 368 | int_char = input_integers.at(counter2); 369 | // Starting Switch 370 | switch (int_char) { 371 | case '1': 372 | output_str += "one "; 373 | break; 374 | case '2': 375 | output_str += "two "; 376 | break; 377 | case '3': 378 | output_str += "three "; 379 | break; 380 | case '4': 381 | output_str += "four "; 382 | break; 383 | case '5': 384 | output_str += "five "; 385 | break; 386 | case '6': 387 | output_str += "six "; 388 | break; 389 | case '7': 390 | output_str += "seven "; 391 | break; 392 | case '8': 393 | output_str += "eight "; 394 | break; 395 | case '9': 396 | output_str += "nine "; 397 | break; 398 | } 399 | } 400 | } 401 | } 402 | std::cout << "Here are the numbers in string: " << output_str << "\n"; 403 | // Exercise 8.7 ends 404 | return(0); 405 | } 406 | --------------------------------------------------------------------------------