Answer: Static local variable is a variable that is initialized as static only one time inside a function and whenever it is called in that function it will be accessible.
Explanation: Static local variables are very useful variables which are declared as static in a particular function. Static local variable is initialized only one time in a function and whenever the function in which it has been declared ,the value of the variable will be accessible by as many times it has been called in the function in which it is declared.
Answer:
I think it's false
Explanation:
I don't think so. What makes me hesitate is that you may have been told that in your text or in the classroom.
Here are the steps as I understand them.
- Understand the problem you are trying to solve.
- Design a solution.
- Draw a flow chart.
- Write pseudo-code.
- Write code.
- Test and debug.
I think you've done the designing long before you start writing code or even pseudo-code.
#include <iostream>
#include <vector>
using namespace std;
class Student
{
public:
Student(int mark)
{
this->mark = mark;
if (mark >= 90 && mark <= 100)
grade = 'A';
else if (mark >= 80 && mark <= 89)
grade = 'B';
else if (mark >= 70 && mark <= 79)
grade = 'C';
else if (mark < 70 && mark >= 0)
grade = 'D';
else
cout << "Invalid mark, grade not assigned";
}
int getMark()
{
return mark;
}
char getGrade()
{
return grade;
}
private:
int mark;
char grade;
};
int main()
{
vector<Student> students;
int num, mark;
cout << "Enter number of students: ";
cin >> num;
if (num <= 0)
cout << "Invalid number of students, exiting";
else
{
for (int i = 1; i <= num; i++)
{
cout << "Enter marks for student " << i << ": ";
cin >> mark;
Student s(mark);
students.push_back(s);
}
}
// do whatever you like with the vector from here onwards, such as:
/*
for (int i = 0; i < students.size(); i++)
{
cout << "Student " << i + 1 << " grade: " << students[i].getGrade() << endl;
}
*/
return 0;
}
A) Undo
In most Windows applications, the Undo command is activated by pressing the Ctrl+Z or Alt+Backspace keybindings.