i got my program and it gots all the things i need except occurence. tell me what is wrong with my reverse command. also if my functions are correct.
i'm getting errors that's saying:
strngprgm.cpp(31) : error C2082: redefinition of formal parameter 'string1'
strngprgm.cpp(32) : error C2082: redefinition of formal parameter 'string3'
strngprgm.cpp(34) : error C2660: 'mstrlen' : function does not take 1 arguments
strngprgm.cpp(35) : error C2660: 'mstrlen' : function does not take 1 arguments
strngprgm.cpp(40) : error C2082: redefinition of formal parameter 'string1'
strngprgm.cpp(41) : error C2082: redefinition of formal parameter 'string3'
strngprgm.cpp(48) : error C2082: redefinition of formal parameter 'string4'
strngprgm.cpp(49) : error C2082: redefinition of formal parameter 'string5'
strngprgm.cpp(54) : error C2447: '{' : missing function header (old-style formal list?
what do these errors mean and how can i chang theme.
and is there an easier way to write the reverse code with out the rit in it.
here is my code so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
//strngprgm
//Micah Standing
#define _CRT_SECURE_NO_DEPRECATE 1
#include <iostream>
#include <string>
using namespace std;
void mstrcpy(char[], char[]);
void mstrlen(char[], char[]);
void mstrcat(char[],char[]);
int main ()
{
char string1[40] = "Thomas Edison";
char string3[40] = "Cracker Jack";
char string4[40] = "How are ";
char string5[40] = "doing ?";
char string6[40] = "Butter Dish";
cout << "String 1 is " << string1 << endl;
cout << "String 3 is " << string3 << endl;
cout << "String 4 is " << string4 << endl;
cout << "String 5 is " << string5 << endl;
}
void mstrlen(char string1[], char string3[])
{
char string1[40] = "Thomas Edison";
char string3[40] = "Cracker Jack";
cout << "\nThe Length of string 1 is " << mstrlen(string1);
cout << "\nThe Length of String 3 is " << mstrlen(string3);
cout << "\n" << endl;
}
void mstrcpy(char string1[], char string3[])
{
char string1[40] = "Thomas Edison";
char string3[40] = "Cracker Jack";
mstrcpy(string1, string3);
cout << "\nNow String 1 is " << string1 << endl;
}
void mstrcat(char string4[],char string5[])
{
char string4[40] = "How are ";
char string5[40] = "doing ?";
mstrcat(string4, string5);
cout << "\nNow String 4 says " << string4 << endl;
}
{
string (string6);
string::reverse_iterator rit;
for ( rit = str.rbegin(); rit < str.rend(); rit++ )
cout << *rit;
return 0;
}
| |