Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I keep getting an error how do I fix this error [Error] invalid conversion from 'int' to 'const char*' [-fpermissive] StringList.h #include #pragma once using

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

I keep getting an error how do I fix this error [Error] invalid conversion from 'int' to 'const char*' [-fpermissive]

StringList.h

#include #pragma once

using namespace std;

class StringList {

public:

//Default constructor StringList();

//Insert single string parameter and returns a bool bool insert(string a);

//remove a single string parameter void remove(string b);

//retrieve a single string parameter void retrieve(string c);

// returns an integer int size();

};

StringList.cpp

#include

#include

#include "StringList.h"

using namespace std;

//Default constructor StringList::StringList(){

}

//Insert a string bool StringList::insert(string a){

return false;

}

//remove a string (has a single integer parameter and returns a string) void StringList::remove(string b){

}

//retrieve a string (has a single integer parameter and returns a string) void StringList::retrieve(string c){

}

//Return a number of value int StringList::size(){

return 0; }

main.cpp

#include

#include

#include "StringList.h"

void exercise1Test() { StringList sList; sList.insert("bob"); string resultString = sList.retrieve(4); resultString = sList.remove(0); cout In this exercise you are to implement the basic structure of a class (related to assignment 1) such that - even though the class methods are not implemented - it will still compile and run. This exercise is intended to illustrate the minimally acceptable standard for assignment submissions. That is, the class and methods meet the requirements for naming, parameter lists and return values described in the assignment and the files are submitted correctly. Requirements 1. Write the class definition of the StringList class in a file named StringList.h. Your class definition should contain the prototypes of the public methods described below. It should not have any private methods or attributes. 2. Write stubs for each of the public methods in a file named StringList.cpp - which should include StringList.h. The default constructor and insert methods should be empty, remove and retrieve should return the empty string('') and size should return zero 3. Submit your StringList.h and StringList.cpp files in a single .zip file with no other folder structure. i.e. your.zip file should contain the two files which should not be contained in another folder. StringList Class Class Description Your class should be named StringList and should have the following public methods: default constructor (i.e. with no parameters) insert - has a single string parameter remove - has a single integer parameter and returns a string retrieve- has a single integer parameter and returns a string size - returns an integer Notes The calling object should be made constant for any method where the calling object's attribute values should not change. Method parameters and return values are noted in the method descriptions - you must not add additional parameters to the methods; if the method description does not mention a parameter it does not have one, similarly if no return value is mentioned the method is void (or a constructor or destructor). Methods must be given the same names as shown above. As described above under requirements your methods should be stubs - either empty if void or returning a default value otherwise. You should not implement their assumed functionality. There is no copy constructor, overloaded assignment operator or destructor specified for this class, which you would normally expect. This is intended to reduce the amount of work for this first exercise. Class Files Your class should consist of a header file called StringList.h that contains the class definition and an implementation file called StringList.cpp that contains the method stubs. Stubs What is a Stub Function? A function that does not contain the intended implementation but still allows the function to be called in a program. Stub functions that return values return some default value, such as 0. min D o main.cpp StringList.h StringList.cpp 1 #include 2 #pragma once 3 4 using namespace std; 5 69 class StringList { 7 8 public: 9 10 //Default constructor 11 StringList(); 12 13 //Insert single string parameter and returns a bool 14 bool insert(string a); 15 16 //remove a single string parameter 17 void remove(string b); 18 //retrieve a single string parameter void retrieve(string c); 19 20 21 22 23 24 25 26 27 // returns an integer int size(); }; I main.cpp StringList.h StringList.cpp 3 #include 4 #include "StringList.h" 6 7 using namespace std; 8 9 //Default constructor 10 StringList:: StringList() { 11 12 } 13 14 //Insert a string 15 bool StringList::insert(string a){ 16 17 return false; 18 19 } 20 21 //remove a string (has a single integer parameter and returns a string) 22 void StringList: : remove(string b){ 23 24 - } 25 26 //retrieve a string (has a single integer parameter and returns a string) 27 void StringList:: retrieve(string c) { 28 29 } 30 31 //Return a number of value 32 int StringList::size(){ 33 34 return 0; main.cpp StringList.h StringList.cpp 1 #include 2 3 #include 4. 5 #include "StringList.h" 6 7 void exerciselTest() 89 9 StringList sList; slist.insert("bob"); 10 string resultString - sList.retrieve(4); resultString = slist.remove(); 13 cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions