I am trying this code in Code::Blocks IDE, but I receive the two errors "Conflicting Declaration" and "cannot convert ...". Can anyone help me please. I indicate errors in the source code below.
Build messages in the Code::Blocks
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
[path]\beginner.cpp|    |In function 'int main()':|
[path]\beginner.cpp|2593|error: conflicting declaration 'const char* result'|
[path]\beginner.cpp| 268|note: previous declaration as 'double result'      |
[path]\beginner.cpp|2596|error: cannot convert 'double' to 'const char*'    |
C:\Program Files\CodeBlocks\MinGW\x86_64-w64-mingw32\include\string.h|68|note:   initializing argument 1 of 'char* strchr(const char*, int)'|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
Code:
#include <iostream>     /// These are Standard Library Feature ()
#include <string>
#include <iomanip>
#include <ios>
#include <limits>
#include <cmath>
#include <vector>
#include <string.h>
using namespace std;
int main(void)
{
     /// std::strchr : find first occurence
     // Find the first occurence of a character
     cout << endl << "std::strchr : " << endl;
     // we use std::strchr to find all the characters one by one
    const char *str {"Try not. Do, or do not. There is no try."};
    char target = 'T';
    const char *result = str;  // First Error occures here 
    size_t iterations{};
    while ((result = strchr(result, target)) != nullptr) {      // 
    And second error occurs here 
    cout << "Found '" << target << " starting at '" << "\n";
    // Increment result, otherwise we'll find target at the same 
 location
        ++result;
        ++iterations;
    }
    cout << "iterations : " << iterations << endl;
}
Thank you for your help.
I have learning C++ in the YouTube. The code works in the tutorial video but not in mine. The ide is VS code in the Tutorial video, mine is Code::Blocks. I am tring all code example in one file so I write preprocessors in the code.
 
     
    