Is it!!! I dont see any hard part on it, However;
The problem with this code is the loop never stops when it reaches the space character.
am not sure if the problem is my compiler
This is the output of entering the string "hell o"
EXECUTING:
/home/moderator/C++/project2/main/readstri
----------------------------------------------
Enter 1 : To Read In A String
Enter 2 : To Find The Size Of The String
Enter 3 : To Copy String A into Sting B
Enter 4 : To Merger String A With Sting B
Enter 5 : To Compare Two Strings
Enter 6 : To Encrypt String A, Method A
Enter 7 : To Encrypt String A, Method B
Enter 8 : To Locate a Character
Enter 9 : To Exit The Program
6
Enter A String
hell o
String A Is Encrypted Now With This Format:
ifmm
Enter 1 : To Read In A String
Enter 2 : To Find The Size Of The String
Enter 3 : To Copy String A into Sting B
Enter 4 : To Merger String A With Sting B
Enter 5 : To Compare Two Strings
Enter 6 : To Encrypt String A, Method A
Enter 7 : To Encrypt String A, Method B
Enter 8 : To Locate a Character
Enter 9 : To Exit The Program
6
Enter A String
hell o
String A Is Encrypted Now With This Format:
ifmm
Enter 1 : To Read In A String
Enter 2 : To Find The Size Of The String
Enter 3 : To Copy String A into Sting B
Enter 4 : To Merger String A With Sting B
Enter 5 : To Compare Two Strings
Enter 6 : To Encrypt String A, Method A
Enter 7 : To Encrypt String A, Method B
Enter 8 : To Locate a Character
Enter 9 : To Exit The Program
6
Enter A String
hell o
String A Is Encrypted Now With This Format:
ifmm
Enter 1 : To Read In A String
Enter 2 : To Find The Size Of The String
Enter 3 : To Copy String A into Sting B
Enter 4 : To Merger String A With Sting B
Enter 5 : To Compare Two Strings
Enter 6 : To Encrypt String A, Method A
Enter 7 : To Encrypt String A, Method B
Enter 8 : To Locate a Character
Enter 9 : To Exit The Program
6
Enter A String
hell o
String A Is Encrypted Now With This Format:
ifmm
.
.
.
.
.
.
The loop wont stop running, if you complie it you will see what I mean
void strencypt(char str[])
{
char star='*';
char str2[10];
int i;
for(i=0;((i<10) && (str[i]!='\0'));i++)
{
if((str[i])== ' ') str2[i]= star;
else str2[i]=int(str[i]+1);
}
std::cout << "String A Is Encrypted Now With This Format: " << "\n";
for(i=0;((i<10) && (str[i]!='\0'));i++)
{
std::cout << str2[i];
}
std::cout << "\n";
}
and this is the part is on my main body
case 6:
{
std::cout << "Enter A String" << "\n";
std::cin >> name;
strencypt(name);
break;
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.