strings help

I AM JUST WANT TO KNOW HOW WOULD I GO ABOUT STARTING THIS BELOW LIKE CAN I HAVE HELP TO GET IT START SO I CAN IT DO IT
MYSELF I ONLY NEED THE START CODE TO GET ME GOING I AM USING BORLAND 5.02
BELOW IS WHAT I HAVE TO DO BUT I AM NOT ASKING YOU TO DO IT ALL I ONLY NEED A PUSH IN THE RIGHT DIRECTION PLEASE.


i am doing my code in borland 5.02

i am trying to write a program that allows the user enter in two strings when prompted

the program performs certain manipulation with the second string and then adds the result to the first string.

the program should give me the user the choice of searching a string for a particular character,
reversing the string ,changing the case of the string and reversing and changing the case of the string the output of the above string manipulation must be preceded by the first string.


the program should be written using modular programing techniques such as functions using parameters where possible to reduce the use of global variables.

the user should be allowed to repeat any of the string manipulations more than once in the same run of the program and be allowed to change the input strings to be manipulated during a run of the program.
HERE YOU GO HERE IS YOUR STARTING CODE TO GIVE YOU A PUSH IN THE RIGHT DIRECTION
1
2
3
4
5
6
#include <iostream>

int main()
{
    std::cout << "Hello, World!" << std::endl;
}
That code does not work say and could i have a bigger start please.
HOW ABOUT THIS
1
2
3
4
5
6
7
#include <iostream>
#include <string>

int main(){
std::string mystring; 
//stuff you want here
}

the program performs certain manipulation with the second string and then adds the result to the first string.
just do
string1 += string2;
when i go to run it the program closes straight away anyhelp with this i am using borland 5.02
HI

TRY THIS

1
2
3
4
5
6
7
8
9
#include <iostream>

int main()
{
    std::cout << "Hello, World!" << std::endl;

    system("PAUSE"); //This pauses the console window
    return 0;
}
Suggestion #1: Upgrade from Borland 5. It's really an outdated piece of junk that doesn't support standard C++ if LB's example didn't compile.

Suggestion #2: std::getline(std::cin,a_string); //Gets a line of text from the console.

Suggestion #3: This page may be worth reading: http://cplusplus.com/reference/string/string/

-Albatross
system("PAUSE"); //This pauses the console window
yeh do not do this. it calls a system function which is something you should avoid. try doing
std::cin.ignore();
or
getchar();
Use std::cin.ignore(unsigned(-1), '\n'); (for the lazy typers) or std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); (for the non-lazy typers)
there is no need to include limits if you are just using it to keep the window open. assuming that the cin buffer is clear.
1
2
 std::cin.sync();
std::cin.ignore();
will keep the window open.
i have to use borland 5.02 so i cannot do anything esle other then borland
Topic archived. No new replies allowed.