Answer:
The function is as follows:
void readAndConvert(){
int n; string symbol,name;
cin>>n;
cin>>symbol;
cin.ignore();
getline (cin,name);
vector<string> trades;
string trade;
for (int inps = 0; inps < n; inps++){
getline (cin,trade);
trades.push_back(trade);}
cout<<name<<" ("<<symbol<<")"<<endl;
for (int itr = 0; itr < n; itr++){
string splittrade[3]; int k = 0;
for(int j=0;j<trades.at(itr).length();j++){
splittrade[k] += trades.at(itr)[j];
if(trades.at(itr)[j] == ' '){
k++; }}
cout<<splittrade[2]<<": "<<floor(stod(splittrade[1]) * stod(splittrade[0]))<<endl; }
}
Explanation:
See attachment for complete program where comments are used to explain each line
Advantages to virtual keyboards:
- You have easy shortcuts
- Cooler emojis <span>
- And we have google voice (or Siri) with a click of a key
Disadvantages to a virtual keyboard:
- It is very easy to send something you don't want to send by
accidentally touching the send button
- It is harder for people with big hands to use
- </span>typing speed will likely be negatively impacted on a virtual keyboard<span>.
</span>
Advantages to using a physical keyboard:
- <span> The keyboard takes up no space on the front panel or on the display area.
</span>- <span>you are making use of muscle memory, which increases your speed
</span>- Typing on a touchscreen requires an on-screen keyboard, which lacks the tactile response of a real keyboard.
Disadvantages to using a physical keyboard:
- <span>For the average consumer, phones with a physical keyboard are a bit bulkier.</span>
- Most phones with a physical keyboard have to be designed a certain way to minimize space and increase efficiency.
- I<span>t is a slow method when you need to write a long piece of writing when there are faster ways such as scanning and dictation</span>
Answer:
processor, primary storage, secondary storage, input devices and output devices
Explanation:
processor, primary storage, secondary storage, input devices and output devices are the five parts of computer hardware that can be found in most computer systems
I think only II contains an error.
Tricky because, syntactically, all three are correct I.M.O.
However, if the goal is to iterate as many times as lotNumLength, then statement II loops one time too many. This is known as an off-by-one error.
Answer:
#include <iostream>
#include <vector>
using namespace std;
void calGPA();
vector<int> g;
vector<int> h;
int main(){
char pushMore = 'y';
int fg, fh;
for (;;){
if (pushMore == 'n'){
break;
} else{
cout<< "Enter integer for grade: ";
cin>> fg;
cout<< "Enter integer for credit hours: ";
cin>> fh;
g.push_back(fg);
h.push_back(fh);
cout<< "Do you want to add more grade and credit hours? y/n: ";
cin>> pushMore;
}
}
calGPA();
}
void calGPA(){
double total = 0, GPA;
for (int i = 0; i < g.size(); ++i) {
total += g.at(i) * h.at(i) ;
}
cout<< "The GPA is : "<< total/g.size();
}
Explanation:
The C++ source code above defines two vectors 'g' and 'h'. The latter holds the grades of a student while the former holds the credit hours for the subject taken. The void 'calGPA' function calculates and prints the student's GPA.