Question: Please modify this source code so that it is written in C instead of C++. I am looking for the same output. Source code: #include

Please modify this source code so that it is written in C instead of C++. I am looking for the same output.

Source code:

#include

#include

#include

using namespace std;

int main()

{

vector dataStr;

vector dataPoint;

string title, header1, header2,s;

cout

getline(cin,title);

cout

cout

getline(cin,header1);

cout

cout

getline(cin,header2);

cout

while(true){

cout

getline(cin,s);

if(s == "-1"){

break;

}

else{

int commaCount = 0;

for(int i=0; i

if(s[i] == ',')

commaCount++;

}

if(commaCount == 0){

cout

}

else if(commaCount > 1){

cout

}

else{

string firstWord = s.substr(0, s.find(","));

string secondWord = s.substr(s.find(",")+1, s.length()-1);

firstWord.erase(0, firstWord.find_first_not_of(' '));

secondWord.erase(0, secondWord.find_first_not_of(' '));

int countNumbers = 0;

for(int i=0; i

if(secondWord[i] >='0' && secondWord[i]

countNumbers++;

}

}

if(countNumbers == secondWord.length()){

dataPoint.push_back(atoi(secondWord.c_str()));

//dataPoint.push_back(stoi(secondWord));

dataStr.push_back(firstWord);

cout

cout

}

else{

cout

}

}

}

}

cout

cout

cout

for(int i=0; i

cout

}

cout

for(int i=0; i

cout

for(int j=0; j

cout

}

cout

}

return 0;

}

Please modify this source code so that it is written in Cinstead of C++. I am looking for the same output. Source code:#include #include #include using namespace std; int main() { vector dataStr; vectordataPoint; string title, header1, header2,s; cout getline(cin,title); cout cout getline(cin,header1); cout cout

9.9 Ch 9 Program: Data visualization (C++) (1) Prompt the user for a title for data. Output the title. (1 pt) Enter a title for the data: Number of Novels Authored You entered Number of Novels Authored (2) Prompt the user for the headers of two columns of a table. Output the column headers. (1 pt) Ex: Enter the column 1 header: Author name You entered Author name Enter the column 2 header: Number of novels You entered Number of novels (3) Prompt the user for data points. Data points must be in this format: string, int. Store the information before the comma into a string variable and the information after the comma into an integer. The user will enter -1 when they have finished entering data points. Output the data points. Store the string components of the data points in a vector of strings. Store the integer components of the data points in a vector of integers. (4 pts) Ex: Enter a data point (-1 to stop input): Jane Austen, 6 Data string: Jane Austen Data integer: 6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!