Home >Backend Development >C++ >Where is tutorial to C?

Where is tutorial to C?

Susan Sarandon
Susan SarandonOriginal
2024-11-23 21:58:15263browse

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;
        }
    }
  1. Let's start to decrypte some example: * - array, **-decart array. We don't use some useful words for creating cycle
  2. Variables i/j making cycle more ordered without much descriprions
  3. Conditions if/else don't put our variables values, but initialize temporary memory 0/1 (like false/true eng)
    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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn