pseudocode Flashcards
What is the first step to take when starting to learn C++?
Focus on grasping the big picture and building a strong foundation.
What is the purpose of libraries in C++?
Libraries provide pre-built functions and tools for various functionalities.
What is the generic skeleton of a C++ program?
It consists of library inclusion and the main function.
What is the syntax to declare the main function in C++?
int main() { /* Your code here */ return 0; }
What library is included for input and output operations in C++?
include<iostream></iostream>
How do you display output in C++?
Using the std::cout function.
What is the correct syntax to print ‘Hey, Striver!’ to the console?
std::cout «_space;‘Hey, Striver!’;
What happens if you write std::cout «_space;‘Hey, Striver!’; twice?
It prints ‘Hey, Striver!Hey, Striver!’ on the same line.
How can you insert a line break in C++ output?
By using the newline character \n.
What does std::endl do in C++?
Inserts a newline character and flushes the output buffer.
Which method is typically faster for adding line breaks in C++?
Using \n is faster than using std::endl.
What does ‘using namespace std;’ do in a C++ program?
Allows use of all names from the std namespace without prefixing with std::.
What is a potential drawback of using ‘using namespace std;’?
It may lead to naming conflicts in larger projects.
How do you take user input in C++?
Using the cin stream.
What is the syntax to read an integer input into a variable x?
cin»_space; x;
What is the output when the input is 10?
Value of x: 10
How can you accept multiple inputs in C++?
Using the»_space; operator with cin for each variable.
What is the shortcut to include almost all standard libraries in C++?
include<bits/stdc++.h>
What is a potential downside of using #include<bits/stdc++.h>?
It may cause compatibility issues and impact compile time.
Fill in the blank: The main function serves as the _______ for your program.
entry point
True or False: std::endl flushes the output buffer after adding a newline.
True