write a program 4 incyption and decryption of a 4 digit code. entered by the user.For incryption use following mechanism:
1.sumofalldigits + current digit%10.
2.replace 1st digit with the 4rth and 2nd with 3rd.
Use functions and pass by reference.
For decryption use reverse mechanism.
ppppllllllzzzzzzzz someone help me!!!!!!!!

Oh God..not again .. I think we need a background script to find such threads and give suitable advice to the OPs' :( ...

We don't give homework help, if you show some effort, we will try to help you do it

commented: Word! +17

Oh God..not again .. I think we need a background script to find such threads and give suitable advice to the OPs' :( ...

We don't give homework help, if you show some effort, we will try to help you do it

Code that i have written for incryption

#include<iostream.h>
void main()
{
	int x[4],num,b[4],sum=0,c[4],d[4];
	cout<<"Enter 4 digit code\n";
	cin>>num;
	for(int a=3;a>=0;a--)
	{
		x[a]=num%10;
		num=num/10;
	}
	for(a=0;a<=3;a++)
    {
		
		sum=sum+x[a];
	}
	for(a=0;a<=3;a++)
	{
		b[a]=sum+x[a];
	}
for(a=0;a<=3;a++)
	{
c[a]=b[a]%10;
cout<<c[a]<<endl;
	}
int r=4;
   for(int i=0;i<=3;i++)
	{d[i]=c[r];
cout<<d[i]<<endl;
r--;
cout<<d[i]<<endl;
	}
}

its just for incryoption but it is not working properly.
i dont know where i heve mistakend.
plz help me in solving the problem

First things first. You need to make your code syntactically correct

1> change #include <iostream.h> to #include <iostream>
2> void main() should be changed to int main() . Don't use void main ever again.
3> in all the 'for loops' you need to give the type 'for (int a=0;....)' or else you could declare 'a' at the top and then use it.
4> cout, cin and endl belong to the std namespace. You need to use the 'using; declaration at the beginning to use them , 'using std::cout' etc. or you can change it at every place you've used it, ex 'std::cout << .. << std::endl'

Please make these changes, compile and test your code and post back again.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.