I have a project that i am working on and i can't get how to get it to work.

I have attached the .h and the main cpp file.

If any one can be of help please reply or im me at xsxixtxhx on Instant messenger.

I need to get this program running and show some output.


Thanks

Attachments
//---------------------------------------------------------------------------
// Vincent Valle 155-76-1527
//CIS 114
//----------------------------------------------------------------------------
#ifndef MyStringH
#define MyStringH
//---------------------------------------------------------------------------
typedef char CharType;  // Creates CharType which is a type of char

class String
{
public:
   // Constructors and Destructor
   String( int capacity = 50 );    // Make empty String with given capacity
   String( const String & str );   // Copy str
   String( const CharType * str, int capacity = 50 );  // Make str a String
   ~String();
   // Queries
   unsigned Length()  const { return count_; }
   bool     IsEmpty() const { return (count_ == 0); }
   bool     IsFull()  const { return count_ == capacity_; }
   int      IndexOf(  const String & str );
   String   SubString( unsigned start, unsigned count ) const;  // Copy out
   const CharType * c_str() const;
   // Modifiers
   CharType & operator[]( int index ) { return string_[index]; } // Unsafe
   bool Delete( unsigned start, unsigned count );
   bool Insert( unsigned pos, const String & str );

private:
   // You supply the private data members
	CharType str[capacity];
	int length, 
		capacity_;
};
//---------------------------------------------------------------------------

#endif
//---------------------------------------------------------------------------
// Vincent Valle 155-76-1527
//CIS 114
//----------------------------------------------------------------------------
#include <iostream.h>
#include "strings.h"
void main
{
String user_string;
int capacity_,
	count_.
	index,
	start,
	pos;
cout<<"Welcome to the String Program"endl;
// Allows users to enter in a String//
cout <<"Please enter in a String"endl;
cin>>userstring;
//------------------------------------------------------//
// Checking if the String is empty
if (IsEmpty());
		cout<< "The String is empty."endl;
else
		count<<"The String is not empty."endl;
//-------------------------------------------------------//
// Check to see if the String is Full
if (IsFull())
		count<<"The String is Full"endl;
else
		count<<"The String is not Full"endl;
//-------------------------------------------------------//
}
//--------------------------------------------------------//
//Index of the String
//--------------------------------------------------------//
//Substring
//--------------------------------------------------------//
// String entered
//-----------------------------------------------------//
//Modifying the String
cout<<"To modify the String please enter a start position location from number 1 - <<count_.Length<<endl;
cin>>index;
count<<"Now 
//-------------Functions begin--------------------//
//String Creating the String
String:: String(int capacity)
{
	char str[capacity];
}
// Copying the string to str
String:: String( const String & str );
{
	strcpy(String, userstring);
	strcpy(str, String);
}

// This makes it into a actually string 
String( const CharType * str, int capacity = 50 );  // Make str a String
{
	str[capacity]=*str;
	capacity_=capacity;
}

//Deconstructor
~String();
// Length of String
String:: unsigned Length()  const { return count_; }
{
	count_=strlen(*str)+1;
	return count_;
}
//Is the String Empty
String:: bool IsEmpty() const ( return (count_== 0));
{
	return (count_ == 0)
}
//Is the String Full
String:: bool IsFull()  const { return count_ == capacity_; }
{
	return (count_ == capacity_);
}
// Index of the String
{
	int IndexOf(  const String & str );
}
//Substring
	String:: SubString( unsigned start, unsigned count ) const;  // Copy out
	{
	}
// shows us the String entered
   String:: const CharType * c_str() const;
   {
	   *c_str=str;
   }
   //----------------------The Modifier Functions------------------------//

   CharType & operator[]( int index ) 
   { 
	   return string_[index];
   } 
   bool Delete( unsigned start, unsigned count );
   bool Insert( unsigned pos, const String & str );

>i can't get how to get it to work
Wow, that's an impressive description of your problem. I think I'll just ignore you since you were rude enough to require everyone to download attached files.

ok thanks. I ask for help and you are sarcastic. If i knew what was wrong with the program i could tell you. I don't know what wrong and am just asking for help. but thanks for being sarcastic.

>I ask for help and you are sarcastic.
You're not entitled to anything. If we think your question lacks the information or courtesy required to deserve help, then we'll let you know. Would you rather be ignored completely, or informed of why your post is insufficient?

>If i knew what was wrong with the program i could tell you.
Clearly it's not doing what you want it to do. Explain wht you expect and how the behavior differs from that expectation. You can't seem to make the distinction between a problem, and the cause of a problem. I want to know what your program is doing wrong, then I'll tell you why it's doing the wrong thing so that you can fix it. That's how a successful exchange works around here.

Hi,

I don't think it was rude for him to make the files as attachments. At least he made an effort to include code that could otherwise been missing. I would rather grab the attachments insted of reading text without the code tags.

As for not providing a description for what is going on, and where his suspicions of error are, I agree. Is it not compiling? What are the errors?

I think his post is along the lines of calling the auto mechanic, and leaving a message that the car won't start. What should the mechanic bring to the vehicle, jumper cables, or a can of gas (in case the tank is empty)?

For his growth, I hope the poster returns with conversation describing the problem in detail. Again, I do not think it was rude of him to provide his code via attachments; If attachments were rude / harassing, we would not allow them in this forum.

Christian

>I don't think it was rude for him to make the files as attachments.
You don't think it's akin to not using code tags? Both require the potential helper to do more work when a courteous thread starter would try his or her best to save the volunteer helpers time and effort. This benefits both the helper and the helped.

I don't know how many years you've posted on forums such as this one to help people with highly technical problems covering a broad range of topics, but I've done it for several years on more than just one forum (amassing many thousands of posts), and I find it insulting when someone makes me download attachments for problems that can usually be solved by eyeballing the code.

>What should the mechanic bring to the vehicle
In my experience the mechanic won't bring anything. He'll make the motorist call a tow truck. :D

>If attachments were rude / harassing, we would not allow them in this forum.
I'm rude and harassing, yet you allow me in this forum. It's only logical that you'd allow other rude, harassing things. :twisted:

Hello,

I agree with you Narue that an isolated snippet is the best way to identify and focus on a logic problem within the code. Quick glance, maybe see a variable passed by reference, or a typo in a function call. That is easier than downloading the whole shebang and putting it together. Then again, if the poster is rather ambiguous, I would rather have the whole shebang, load it into my environment, and hit the run button. You are correct that it is a lot of work.

DaniWeb is the first web-based forum like this that I have participated in at the moderator level. I have done parts here and there for other locations; most of my roots are in USENET groups. I am a casual code-slinger; I mostly code Linux BASH scripts to do system admin things. I am a network administrator that dabbles in code for hobby and curiousity.

Unfortunately, DaniWeb doesn't have any written guidelines for this forum (C++ Coding) that specify when to do an attachment vs. a chunk of lines vs. a posting of a particular function. Then again, I am not certain that a lot of new people stop to read the README on the forum; we have witnessed this type of posting before. I also strongly believe that the people needing the help do not know how to ASK for the help... thus posts like the one that started this discussion.

I like your reply on the tow truck. I have 3 younger sisters, and had to respond bringing a whole pile of things with me.

I am wondering, Narue, if you would like to work with me on developing a "standard" for how to post topics. A sheet describing when to do a snippit, when to do an attachment, and when to use the code tags. I cannot guarentee that the new users will read it (or understand it), but if 20% do, I think it is worth the little bit of effort. Think of what to put in there, and maybe some eye candy on the header to attract people to read it. Drop me a note if you are interested.... others are welcome to participate too.

Otherwise, I think we should turn the attention back to xsxixtxhx and see what direction he/she will take with this code problem at hand.

Christian

This article has been dead for over six months. Start a new discussion instead.