Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele String Manipulation Practice | Text Data Type
C++ Data Types

book
String Manipulation Practice

h

replace

copy
// replaces n characters starting from start with str2
str.replace(start, n, str2)
12
// replaces n characters starting from start with str2 str.replace(start, n, str2)
Tehtävä

Swipe to start coding

  1. Replace the "debug" with "release".
  2. Your program should output mode=release.

Ratkaisu

cpp

solution

#include <iostream>

int main()
{
std::string config = "mode=debug"; // Do not change this line

config.replace(5, 5, "release"); // Replace "debug" with "release"
std::cout << config; // Do not change this line
}

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 5
#include <iostream>

int main()
{
std::string config = "mode=debug"; // Do not change this line
config.replace(___, ___, ___); // Replace "debug" with "release"
std::cout << config; // Do not change this line
}

Kysy tekoälyä

expand
ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

We use cookies to make your experience better!
some-alt