Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3878792
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:39:09+00:00 2026-05-19T22:39:09+00:00

Thanks for helping me in advance! I am used to Java and C# but

  • 0

Thanks for helping me in advance! I am used to Java and C# but C++ is completely different. I am trying to do part B of this lab: http://cs.binghamton.edu/~sgreene/cs240-2010f/labs/lab2.html

Is this the idea that is assigned in Part B? Also I dont know what exactly is missing in the header file that deals with indef endif, etc. I did research and I dont seem to miss anything. And lastly, what does the lab assignment mean when it says: “In the [] operator, the index should be checked to confirm it is between 0 and 9. If it is not, the string “Undefined” should be returned instead.” Thanks

ok so here are my updated files

#include "TenStrings.h"

using namespace std;

//Default Constructor
TenStrings::TenStrings()
{
    public:

    TenStrings str[10];
    str[0] = "String 1";
    str[1] = "String 2";
    str[2] = "String 3";
    str[3] = "String 4";
    str[4] = "String 5";
    str[5] = "String 6";
    str[6] = "String 7";
    str[7] = "String 8";
    str[8] = "String 9";
    str[9] = "String 10";
}
;

main.cpp
————————–*/

#include "TenStrings.h"
#include <iostream>

int main()
{
    TenStrings varTen;

    std::cout << str[2] << std::endl;
    return 0; 
}

also is the line missing in my header file: #include ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:39:10+00:00Added an answer on May 19, 2026 at 10:39 pm

    I notice that the assignment carries this warning:

    This is an individual assignment – you may NOT work in groups. Do not write or dictate code for anyone else, and do not use code from anyone else. If you break this rule, you may fail the entire class.

    Hence I will provide only some guidance, not code.

    First I dont know where to create the
    new data strings, whether it should be
    in my header class or tenstrings.cpp?

    The assignment says:

    Implement this TenStrings class such
    that it acts as an array of 10
    constant-data strings. Start with the
    basic [] operator, and the
    constructor.

    The word “implement” is key. Until you know about inline function definitions (which I’m guessing you haven’t gotten to yet), implementation always needs to be in one of the cpp files (in this case, tenstrings.cpp.)

    Should I create an array of empty
    strings? or an array of String1,
    string2, string3, etc?

    The assignment says:

    In the constructor, the 10 strings
    should initially be set to “First
    String”, “Second String”, etc….

    In other words, the constructor for the TenString class should make the first string (i.e., at index [0]) have the exact value "First String"; and so on up through the tenth string (at index [9]) having the exact value "Tenth String". Apparently, the intent is to be able to change these assignments through the [] operator, which you are to write as part of the TenString class.

    I hope this helps. (I think that I’ve interpreted the assignment correctly, but I can’t guarantee that.)

    Oh, and by the way, there’s no need for this line:

    #include <string>
    

    since the assignment specifically says not to use the String class.

    EDIT: Also, the header file seems to be missing a line at the beginning. The missing line is related to the #ifndef / #define / #endif protection that’s mentioned in the assignment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this is too simple, but thanks in advance for helping. This is
THANKS FOR HELPING!!! Ok... So I am trying to write a script that will
thanks for helping a novice. I'm trying to use the value of a Text
Thanks to everyone out there helping newbies like me. So far I have this:
Thanks in advance for helping me out (for those who have time and are
Hey, first of all thanks for helping me out with this (probably stupid) question
and thanks in advance for helping. I am creating a log in screen for
Hi Thanks in advance for helping. I have the following table: create table temp_vol
First of all I want to say thanks in advance for helping me. I
I am following Meera Subbarao to create java docs using umlgraph but getting this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.