Difference between revisions of "Team Name (Official)"

From CDOT Wiki
Jump to: navigation, search
(Topic)
(Topic)
Line 18: Line 18:
 
=====Topic=====
 
=====Topic=====
 
encrypting text
 
encrypting text
---
+
----
 
+
<pre>
 
#include <iostream>
 
#include <iostream>
  
Line 143: Line 143:
  
 
}
 
}
 
+
</pre>
---
+
----
  
 
=== Assignment 2 ===
 
=== Assignment 2 ===
 
=== Assignment 3 ===
 
=== Assignment 3 ===

Revision as of 22:07, 7 February 2013


GPU610/DPS915 | Student List | Group and Project Index | Student Resources | Glossary

Teamname.png

Project Name TBA

Team Members

  1. Graeme Smyth, Some responsibility
  2. Roman Hotin, Some other responsibility

Email All

Progress

Assignment 1

Graeme Smyth

Topic

Making parallel an application which calculates the first n primes.


Roman Hotin

Topic

encrypting text


#include <iostream>

#include <cstdlib>

#include <ctime>

#include <cstring>

#include <string>

#include <cctype>



using namespace std;

void Encrypt(string&);

string Decrypt(string strTarget);





int main(int argc, char* argv[]) {

	//initialize and get the string from the user

	string strTarget;

	cout << "Enter a string to encrypt: ";

	//getline(cin,strTarget);

	strTarget = argv[1];

	string temp(strTarget);

	Encrypt(strTarget);



	cout << "Encrypted: " << strTarget << endl;

	cout << "Decrypted: " << Decrypt(strTarget) << endl;



	return 0;

}



void Encrypt(string &strTarget)

{

	int len = strTarget.length();

	char a;

	string strFinal(strTarget);

	for (int i = 0; i <= (len-1); i++)

	{

		a = strTarget.at(i); 

		int b = (int)a; //get the ASCII value of 'a'

		b += 2; //Mulitply the ASCII value by 2

		if (b > 254) { b = 254; }

		a = (char)b; //Set the new ASCII value back into the char

		strFinal.insert(i , 1, a); //Insert the new Character back into the string

	}

	string strEncrypted(strFinal, 0, len);

	strTarget = strEncrypted;

}



string Decrypt(string strTarget)

{

	int len = strTarget.length();

	char a;

	string strFinal(strTarget);

	for (int i = 0; i <= (len-1); i++)

	{

		a = strTarget.at(i);

		int b = (int)a;

		b -= 2;



		a = (char)b;

		strFinal.insert(i, 1, a);

	}

	string strDecrypted(strFinal, 0, len);

	return strDecrypted;

}

Assignment 2

Assignment 3