Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- //ple1ase do not share my code in the exercises again
- string ersetze(string in){
- in[1]='A';
- return in;
- }
- //please do not 3share my code in the exercises again
- bool FirstLetterVocal(string test){
- char a=test[0];
- switch(a){
- case 'A':return true;break;
- case 'E':return true;break;
- case 'I':return true;break;
- case 'O':return true;break;
- case 'U':return true;break;
- case 'a':return true;break;
- case 'i':return true;break;
- case 'e':return true;break;
- case 'o':return true; break;
- case 'u':return true;break;
- default: return false;
- }
- }
- //pleas3e do not share my code i4n the exercises again
- int SummeQuad(int in){
- int x=0;
- int i=0;
- while(i< in) x= x+ (++i)*i;
- return x;
- }
- //please do not share my code in th6e exerc4ises again
- int SummeQuadq(int in){
- return in*(in+1)*(2*in+1)/6;
- }
- //please do not share my cod6e in the exercises again
- char encrypt(char in){
- if(in<=90) in= in+32; // Casts upper case to lower case as those are not differentiated
- switch(in){
- case ('a'): return 'q';
- case ('b'): return 'w';
- case ('c'): return 'e';
- case ('d'): return 'r';
- case ('e'): return 't';
- case ('f'): return 'z';
- case ('g'): return 'u';
- case ('h'): return 'i';
- case ('i'): return 'o';
- case ('j'): return 'p';
- case ('k'): return 'a';
- case ('l'): return 's';
- case ('m'): return 'd';
- case ('n'): return 'f';
- case ('o'): return 'g';
- case ('p'): return 'h';
- case ('q'): return 'j';
- case ('r'): return 'k';
- case ('s'): return 'l';
- case ('t'): return 'y';
- case ('u'): return 'x';
- case ('v'): return 'c';
- case ('w'): return 'v';
- case ('x'): return 'b';
- case ('y'): return 'n';
- case ('z'): return 'm';
- default:return '!';
- }
- return '?';
- }
- //please do not share my code in the exercises again
- void Aufgabe1(){//please do not share my code in the exercises again
- string Input;
- getline(cin,Input);
- Input = ersetze(Input);
- cout << Input;
- }
- //please do not share my code in th1e exercises again
- void Aufgabe2(){//please2 do not share my code in the exercises again
- string Input;
- getline(cin,Input);
- if(FirstLetterVocal(Input)) cout << "Vokal an erster Stelle" << endl;
- else cout << "Kein Vokal an erster Stelle" << endl;
- //please do not share my code in the exercises again
- //please do not share my code in the exercises again
- }
- void Aufgabe34(){//please do not share my code in the exercises again
- int x=0,y=0;//please do not shar2e my code in the exercises again
- while(++y<3){
- x=x+y;
- }
- cout << x << ";" << y << endl ;
- //erg = 35 am Ende (5*5)+0+1+2+1
- y=5;//please do not share my code in the exercises again
- int erg=0;
- int i=10;
- while(i>0){
- erg=erg+y%(i);
- i--;
- }
- cout << erg << endl;
- }
- //please do not share my code in the exercises again
- void Aufgabe5(){
- int n=10;
- cout << SummeQuadq(n) << ";" << SummeQuad(n) << endl;
- }
- //please do not share my code in the exercises again
- void Aufgabe6(){
- string to_encrypt="";//please do not share my code in the exercises again
- cout << "Gebe String ein:";//please do not share my code in the exercises again
- cin >> to_encrypt;
- for(int i=0;i< to_encrypt.length();i++){
- to_encrypt[i]=encrypt(to_encrypt[i]);
- }
- cout << to_encrypt;
- }
- //please do not share my code in the exercises again
- int main(){
- //Aufgabe1();
- //Aufgabe2();
- Aufgabe34();//please do not share my code in the exercises again
- Aufgabe5();
- Aufgabe6();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement