#include<iostream>
using namespace std;
int n, ar[100];
void takin()
{
cout <<"number of element: "; cin>> n;
cout <<"put in the elements: ";
for(int x=0; x<n; x++)
{
cin>> ar[x];
}
}
void show()
{
cout <<"\nelements are: ";
for(int y=0; y<n; y++)
{
cout <<ar[y] <<' ';
}
}
void precal()
{
cout <<"\n\nPre-Cal: ";
for(int z=0; z<n; z++)
{
ar[z+1]+=ar[z];
cout <<ar[z] <<' ';
}
}
int main()
{
takin(); show(); precal();
cout <<endl<<endl<<endl<<endl<<endl;
return 777;
}
|
Morse Code |
#include<iostream>
using namespace std;
char c, x;
int check(char);
void go(char);
void start()
{
cout <<"give your input hea: "; cin>> c;
check (c);
}
int check(char)
{
try
{
if((c>=65 && c<=90)||(c>=97 && c<=122))
{go(c);}
else
{throw x;}
}
catch(...)
{
cout<<"\n\ntry again fella!\ngive it again: ";
cin>> c;
check(c);
}
return 1;
}
void go(char c)
{
cout <<"\n\nin morse code it is: ";
if(c=='a' || c=='A')
{cout <<".-\n\n\n";}
else if(c=='b' || c=='B')
{cout <<"-...\n\n\n";}
else if(c=='c' || c=='C')
{cout <<"-.-.\n\n\n";}
else if(c=='d' || c=='D')
{cout <<"-..\n";}
else if(c=='e' || c=='E')
{cout <<".\n";}
else if(c=='f' || c=='F')
{cout <<"..-.\n\n";}
else if(c=='g' || c=='G')
{cout <<"--.\n";}
else if(c=='h' || c=='H')
{cout <<"....\n";}
else if(c=='i' || c=='I')
{cout <<"..\n";}
else if(c=='j' || c=='J')
{cout <<".---\n\n";}
else if(c=='k' || c=='K')
{cout <<"-.-\n";}
else if(c=='l' || c=='L')
{cout <<".-..\n";}
else if(c=='m' || c=='M')
{cout <<"--\n";}
else if(c=='n' || c=='N')
{cout <<"-.\n\n";}
else if(c=='o' || c=='O')
{cout <<"---\n\n";}
else if(c=='p' || c=='P')
{cout <<".--.\n";}
else if(c=='q' || c=='Q')
{cout <<"--.-\n";}
else if(c=='r' || c=='R')
{cout <<".-.\n";}
else if(c=='s' || c=='S')
{cout <<"...\n";}
else if(c=='t' || c=='T')
{cout <<"-\n";}
else if(c=='u' || c=='U')
{cout <<"..-\n\n";}
else if(c=='v' || c=='V')
{cout <<"...-\n";}
else if(c=='w' || c=='W')
{cout <<".--\n";}
else if(c=='x' || c=='X')
{cout <<"-..-\n";}
else if(c=='y' || c=='Y')
{cout <<"-.--\n";}
else if(c=='z' || c=='Z')
{cout <<"--..\n";}
}
int main(void)
{
start();
return 0;
}
To Remember It:
|
Morse Code |