A rational database is a one consisting of more than one table. It includes all fields of description and its relationships.
Answer:
A Program was written to carry out some set activities. below is the code program in C++ in the explanation section
Explanation:
Solution
CODE
#include <iostream>
using namespace std;
int main() {
string name; // variables
int number;
cin >> name >> number; // taking user input
while(number != 0)
{
// printing output
cout << "Eating " << number << " " << name << " a day keeps the doctor away." << endl;
// taking user input again
cin >> name >> number;
}
}
Note: Kindly find an attached copy of the compiled program output to this question.
Answer:
In C++:
#include<iostream>
#include<vector>
using namespace std;
int main(){
int len, num;
vector<int> vect;
cout<<"Length: ";
cin>>len;
for(int i = 0; i<len;i++){
cin>>num;
vect.push_back(num);}
vector<int>::iterator iter;
for (iter = vect.end() - 1; iter >= vect.begin(); iter--){
cout << *iter << ", ";}
}
Explanation:
This declares the length of vector and input number as integer
int len, num;
This declares an integer vector
vector<int> vect;
This prompts the user for length
cout<<"Length: ";
This gets the input for length
cin>>len;
The following iteration gets input into the vector
<em> for(int i = 0; i<len;i++){</em>
<em> cin>>num;</em>
<em> vect.push_back(num);}</em>
This declares an iterator for the vector
vector<int>::iterator iter;
The following iterates from the end to the beginning and prints the vector in reverse
<em> for (iter = vect.end() - 1; iter >= vect.begin(); iter--){</em>
<em> cout << *iter << ", ";}</em>
<em />
<em />