Hi, I have a program and i cant seem to get it to work. I need to write a program that can take up to 50 strings and then reverse them...

The actual question is:
Write a program that will prompt the user for two strings of characters(each string has maximum 50 characters) , assemble them into a single string and then print the string out reversed.

So far i have this


void Reverse(string &InputString);
void Reverse(string &InputString2);

void CharacterSwap(char First, char Second);

void main()
	char InputString;
	printf("Please enter the First string... ");
	scanf("%s", &InputString);

	printf("Please enter the Second string... ");
	scanf("%s", &InputString2);
	printf("You entered: ");
	for(int i = 50; i < InputString.length(); i++)
	printf("The string reversed is : ");
	for(int j = InputString.length(); j > 50 ; j--)

	printf("", endl endl);

void Reverse(string &InputString)
	int Begin = 1,
		End = InputString.length();
	while(Begin < End)
		CharSwap(InputString[Begin], InputString[End]);

	void CharSwap(char& First, char& Second)
	char Temp;
	First = Second;
	Temp = First;
	Second = Temp;

<< moderator edit: added [code][/code] tags >>

I also have a nother source that works but i cant get the second one to work
please i need help soon:

#include <stdio.h>
 #include <string.h>

int main ( ) {
    char str[50];
	char string[50];
    int i, add, add1;

    printf("Enter First string   : ");
    scanf("%49[^\n]%*c", str);
	printf("Enter Second string   : ");
    scanf("%49[^\n]%*c", string);

    printf("In reverse order : ");
    add = strlen(str), add1 = strlen(string);
	for (i = (add + add1) - 1; i >= 0; i--)
         putchar(str[i], string[i]);

    return 0;


I figured it out so thanxs for anyone that was going to help me

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