| Welcome | |
|---|---|
|
Welcome to the forums of AntiRTFM's Absolute N00b Spoonfeed C++ Tutorials! You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>! |
|
#include <iostream>
using namespace std;
int main(){
char line[100];
for (int y = 0; y <= 99; y++)
line[y] = '%';
cout << "Enter a line of text up to 100 characters. End it with a percent sign (%).\n";
cin.getline(line, 100, '%');
cout << "Here is your line: ";
cout << line << endl;
cout << "Now here is your line in reverse: ";
for (int x = 99; x >= 0; x--)
{
if (line[x] != '%')
cout << line[x];
}
cout << endl;
system("PAUSE");
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "Enter your name: ";
getline(cin,name);
cout << "\nHere is your name in reverse: ";
int i = name.length();
while (i >= 0)
{
printf("%c", name[i]);
i--;
}
cout << "\n\nHit any key to quit.\n\n";
cin.ignore();
return 0;
}
#include <iostream>
using namespace std;
int main()
{
string name;
cout << "please enter your name" << endl;
cin >> name;
for (int i = name.size();i >= 0;i--)
{
cout << name[i];
}
}
#include "stdafx.h"
#include <iostream>
using namespace std;
int main(){
cout<<"Hi what is your name?\n";
cout<<"Type your name letter by letter after each letter press enter\n";
cout<<"When your done press - and enter till you get your result\n";
char a,b,c,d,e,f,g,h,i,j;
cin>>a;
cin>>b;
cin>>c;
cin>>d;
cin>>e;
cin>>f;
cin>>g;
cin>>h;
cin>>i;
cin>>j;
cout<<a<<b<<c<<d<<e<<f<<g<<h<<i<<j;
cout<<"Sounds for me like: ";
cout<<j<<i<<h<<g<<f<<e<<d<<c<<b<<a<<endl;
system("PAUSE");
return 0;
}#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
cout <<"First Name: ";
char name[10];
cin >> name;
for(int x = strlen(name); x >= 0; x--)
{
cout << name[x];
}
system("pause");
return 0;
}
Users browsing this forum: No registered users and 0 guests