Menu
Coddy logo textTech

Extracts Integers

Lesson 13 of 18 in Coddy's Functions in C++: Building Your Own Functions course.

challenge icon

Challenge

Easy

Write a function that extracts integers from a given input.


The function getIntegers will take a string as input, extract the integers from it, and return the resulting integer.

 

For example, if the input is: <strong>"Coddy2024"</strong>
The output will be: <strong>2024</strong>

Try it yourself

#include <iostream>
#include <string>
using namespace std;

int getIntegers(string str){


}

All lessons in Functions in C++: Building Your Own Functions