Skip to content

Instantly share code, notes, and snippets.

@swimmi
swimmi / Word Reversal
Created April 20, 2014 14:01
Output a line with each word reversed without changing the order of the words
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
using namespace std;
//Output a line with each word reversed without changing the order of the words.
int main()
{
//ifstream cin("word_reversal.txt");
@swimmi
swimmi / Reverse Text
Created April 20, 2014 11:59
Reverse the text
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;
//Reverse the text.
int main()
{
//ifstream cin("reverse_text.txt");
int n;
int index=1;
@swimmi
swimmi / Geometry Made Simple
Created April 20, 2014 05:26
Computing the length of the third side in a right-angled triangle
#include <fstream>
#include <iostream>
#include <cmath>
using namespace std;
//Computing the length of the third side in a right-angled triangle.
int main()
{
//ifstream cin("geometry_made_simple.txt");
int a,b,c;
int index=0;
@swimmi
swimmi / Box of Bricks
Last active August 29, 2015 14:00
Make all stacks the same height within the minimum moves
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;
//Make all stacks the same height within the minimum moves.
int main()
{
//ifstream cin("box_of_bricks.txt");
int n;
int index=1;
@swimmi
swimmi / Digital Roots
Last active August 29, 2015 14:00
Summing the digits of the integer
#include <fstream>
#include <iostream>
#include <sstream>
using namespace std;
//Summing the digits of the integer.
int main()
{
//ifstream cin("digital_roots.txt");
string s;
while(cin >> s)
@swimmi
swimmi / The Seven Percent Solution
Created April 19, 2014 13:10
Percent-encode a string of characters
#include <fstream>
#include <iostream>
#include <string>
#include <map>
using namespace std;
//Percent-encode a string of characters.
int main()
{
//ifstream cin("the_seven_percent_solution.txt");
map<char,char> m;
@swimmi
swimmi / hello world!
Last active August 29, 2015 14:00
Hello World
#include <iostream>
using namespace std;
//Hello World.
int main()
{
cout<<"hello world!"<<endl;
return 0;
}