Home >Backend Development >C++ >Where is tutorial to C?
C - OOP-language for structure, where we don't know all objects and actions (e.g. microservice with 10 integrations or Arduino).
A = (int **)malloc(n * sizeof(int *)); for (int i = 0; i < n; i++) A[i] = (int *)malloc(n * sizeof(int)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (sqrt(Vert[i] + Vert[j]) - (int)sqrt(Vert[i] + Vert[j]) < 0.001) A[i][j] = 1; else A[i][j] = 0; } }
ofstream answerFile; answerFile.open(file_name); for (int i = 0; i < n; i++) { answerFile << Vert[Path[i]] << " "; } answerFile.close();
Files - memory with undetectable type of variables (e.g. .doc/.txt/.img).
I'm using several algorithms for opening/closing files with library .
class Graph { private: std::vector <int> Vert; int **A, n; std::vector <int> Path; std::vector <bool> Visited;
Don't forget creating 2 different types: .h - header file; .c/.cpp - working file. It's help compiler handle exceptions more quickly.
Class Graph defines memory area under some variables and functions. Decart array A and integer type n are identified like path of class. Fuctions Vert and Path will work inviseble to the user (Cos private path). And Visited will have values 0/1.
The above is the detailed content of Where is tutorial to C?. For more information, please follow other related articles on the PHP Chinese website!