Simple Function Creation
Uppgift
Swipe to start coding
Your task is to create a function and call this function in the main()
function:
- Create function signature:
- specify
std::string
return type; - specify
helloWorld
as the name of the function
- specify
- Return string "Hello World".
- Call the function using its name.
Lösning
solution
99
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
std::string helloWorld()
{
return "Hello World!";
}
int main()
{
std::cout << helloWorld();
}
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 3
99
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
___ ___()
{
___ "Hello World!";
}
int main()
{
std::cout << ___();
}
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal