Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Variable Practice | Variables and Data Types
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
C++ FOundations: V1

bookChallenge: Variable Practice

Task

Swipe to start coding

Write a C++ program that does the following:

  • Declare an int variable and assign it a value.
  • Declare a double variable and assign it a value.
  • Declare a std::string variable and assign it a value.
  • Print all three variables to the console, each on a separate line.

Your program should contain a main function as the entry point. Use std::cout to print the variable values. Remember to include the necessary headers for using std::string and std::cout.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 3
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: Variable Practice

Swipe to show menu

Task

Swipe to start coding

Write a C++ program that does the following:

  • Declare an int variable and assign it a value.
  • Declare a double variable and assign it a value.
  • Declare a std::string variable and assign it a value.
  • Print all three variables to the console, each on a separate line.

Your program should contain a main function as the entry point. Use std::cout to print the variable values. Remember to include the necessary headers for using std::string and std::cout.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 3
single

single

some-alt