Question: Question: I am getting errors in this code. What am I doing wrong here? How do I get the code to count the coins in

Question:

I am getting errors in this code. What am I doing wrong here?

How do I get the code to count the coins in my .csv file?

Below is the code and an attachment of my errors:

#include #include #include #include #include #include #include #include using namespace std; const string myFile = ("Coins.csv");

#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #include "doctest.h"

class Crypto {

struct Coins { int rank; string name; string symbol; double marketCap; };

fstream file; vectorarr; fstream myFile;

public: bool OpenFile(string fileName) { myFile.open(fileName); if (!myFile.is_open()) { cout

int ParseCurrencies() { vector row; string line, word; vectorarr; fstream myFile; while (getline(myFile, line)) { row.clear(); stringstream str(line); while (getline(str, word, ',')) row.push_back(word); Coins temp; temp.rank = stoi(row[0]); temp.name = row[1]; temp.symbol = row[2]; temp.marketCap = stoi(row[3]); arr.push_back(temp); } cout

}

int CountCoinsStartingWithLetter(char a) { vector row;

string name; int cnt = 0; for (int i = 0; i

TEST_CASE("Testing the Crypto Coins Class") { Crypto cryptos; CHECK(cryptos.OpenFile("Coins.csv") == true); CHECK(cryptos.ParseCurrencies() == COUNT_COINS); CHECK(cryptos.CountCoinsStartingWithLetter('a') != 5); CHECK(cryptos.CountCoinsStartingWithLetter('a') == 6); CHECK(cryptos.CountCoinsStartingWithLetter('a') != 7);

}; ;

Question: I am getting errors in this code. What am I doing

96 abs E0020 identifier "COUNT_COINS" is undefined A C26495 Variable 'Crypto::Coins::marketCap' is uninitialized. Always initialize a member variable (type.6). A C26495 Variable 'Crypto::Coins:rank' is uninitialized. Always initialize a member variable (type.6). C2065 'COUNT_COINS': undeclared identifier 31 31 96

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!