made a program 09-01-2011, 11:57 AM
#1
Hello i have coded a program in C++. the program based on Tri Code from wikihow, so Download it here and try it. or if you got a compiler this is the code
what do you think????
Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string texts; // regular texts
string output; // converted texts
cout << "Type some texts: ";
getline(cin,texts); // user input the text
while(int i = texts.length()) //
{
texts[i+1]=' ';
texts[i+2]=' ';
texts[i+3]=' ';
break;
}
for (int i=0;i<=texts.length();i++) // Removing Spaces
{
if (texts[i]==' ')
{
for (int g = i;g<=texts.length();g++)
texts[g]=texts[g+1];
}
}
for (int i=0;i<=(texts.length());i+=3) // Convertings
{
output[i]=texts[i+2];
output[i+1]=texts[i+1];
output[i+2]=texts[i];
}
cout << endl;
cout << "Output text: ";
for (int i=0;i<=texts.length();i+=3) // Output the converted texts with a space every 3 characters
{
cout<<output[i];
cout<<output[i+1];
cout<<output[i+2];
cout<<" ";
}
cout<< endl;
cout<< endl;
cout<<"Press any key";
cin.get();
return 0;
}
what do you think????
(This post was last modified: 09-02-2011, 11:22 AM by Azade.)
![[Image: dd.png]](http://i1185.photobucket.com/albums/z348/EndlSS33/dd.png)