int main() { int i = 4; int j = 3; int size = i*j; double* A = new double[size]; double* B = new double[size]; double* C = new double[size]; fill_from_file(B, size, "B.data"); fill_from_file(C, size, "C.data"); /****** * FILL IN CODE HERE *****/ func1(A, B, C, i, j); /****** * FILL IN CODE HERE END END END *****/ double* A_check = new double[size]; fill_from_file(A_check, size, "A.data"); auto check = check_result(A, A_check, size, 2); delete[] A; delete[] A_check; delete[] B; delete[] C; return (check ? 0 : 1); };
int main() { vector<Readings> read_temps; fill_from_file(read_temps, "raw_temps.txt"); cout << "The mean reading is: " << mean_readings(read_temps) << '\n'; cout << "The median reading is: " << median_readings(read_temps) << '\n'; }
int main() { int i = 4; int j = 3; int k = 2; int sizea = i*j; double* A = new double[sizea]; int sizeb = i*k; double* B = new double[sizeb]; int sizec = i*k; double* C = new double[sizec]; int sized = k*j; double* D = new double[sized]; fill_from_file(B, sizeb, "B.data"); fill_from_file(C, sizec, "C.data"); fill_from_file(D, sized, "D.data"); /****** * FILL IN CODE HERE *****/ func1(A, B, C, D, i, j, k); /****** * FILL IN CODE HERE END END END *****/ double* A_check = new double[sizea]; fill_from_file(A_check, sizea, "A.data"); auto check = check_result(A, A_check, sizea); delete[] A; delete[] A_check; delete[] B; delete[] C; delete[] D; return (check ? 0 : 1); };
int main() { int i = 4; int j = 3; int k = 2; int l = 5; int m = 6; int n = 7; int sizea = l*j*k*i; double* A = new double[sizea]; int sizeb = n*j*m*i; double* B = new double[sizeb]; int sizec = l*n*k*m; double* C = new double[sizec]; fill_from_file(B, sizeb, "B.data"); fill_from_file(C, sizec, "C.data"); /****** * FILL IN CODE HERE *****/ func1(A, B, C, i, j, k, l, m, n); /****** * FILL IN CODE HERE END END END *****/ double* A_check = new double[sizea]; fill_from_file(A_check, sizea, "A.data"); auto check = check_result(A, A_check, sizea, 96); delete[] A; delete[] A_check; delete[] B; delete[] C; return (check ? 0 : 1); };
int main() { vector<int> Sum_Parts; int Sum = 0; cout << "Please enter the file name to be read: "; string name; cin >> name; fill_from_file(Sum_Parts, name); for (int i = 0; i < Sum_Parts.size(); ++i) { cout << Sum_Parts[i] << '\n'; Sum += Sum_Parts[i]; } cout << "\nThe total sum is: " << Sum << '\n'; }
NMConfig * nm_config_new (const char *cli_config_path, const char *cli_plugins, const char *cli_log_level, const char *cli_log_domains, const char *cli_connectivity_uri, const gint cli_connectivity_interval, const char *cli_connectivity_response, GError **error) { NMConfig *config; GError *local = NULL; config = g_malloc0 (sizeof (*config)); if (cli_config_path) { /* Bad user-specific config file path is a hard error */ if (!fill_from_file (config, cli_config_path, cli_plugins, cli_log_level, cli_log_domains, cli_connectivity_uri, cli_connectivity_interval, cli_connectivity_response, error)) { nm_config_free (config); return NULL; } return config; } /* Even though we prefer NetworkManager.conf, we need to check the * old nm-system-settings.conf first to preserve compat with older * setups. In package managed systems dropping a NetworkManager.conf * onto the system would make NM use it instead of nm-system-settings.conf, * changing behavior during an upgrade. We don't want that. */ /* Try deprecated nm-system-settings.conf first */ if (fill_from_file (config, NM_OLD_SYSTEM_CONF_FILE, cli_plugins, cli_log_level, cli_log_domains, cli_connectivity_uri, cli_connectivity_interval, cli_connectivity_response, &local)) return config; if (g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND) == FALSE) { fprintf (stderr, "Default config file %s invalid: (%d) %s\n", NM_OLD_SYSTEM_CONF_FILE, local ? local->code : -1, (local && local->message) ? local->message : "unknown"); } g_clear_error (&local); /* Try the standard config file location next */ if (fill_from_file (config, NM_DEFAULT_SYSTEM_CONF_FILE, cli_plugins, cli_log_level, cli_log_domains, cli_connectivity_uri, cli_connectivity_interval, cli_connectivity_response, &local)) return config; if (g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND) == FALSE) { fprintf (stderr, "Default config file %s invalid: (%d) %s\n", NM_DEFAULT_SYSTEM_CONF_FILE, local ? local->code : -1, (local && local->message) ? local->message : "unknown"); g_propagate_error (error, local); nm_config_free (config); return NULL; } /* If for some reason no config file exists, and NM wasn't given on on * the command line, just use the default config file path. */ if (config->path == NULL) { config->path = g_strdup (NM_DEFAULT_SYSTEM_CONF_FILE); fprintf (stderr, "No config file found or given; using %s\n", NM_DEFAULT_SYSTEM_CONF_FILE); } /* ignore error if config file not found */ g_clear_error (&local); return config; }