Question #198519

Design a C program to exchange the keys. The Two friends Bob and Jim met in a bank and discussed about their secret code. They decided to exchange their passwords for further transactions. Password of Bob is "Apple" and Jim is Orange". Print the password of Jim and Bob.


Expert's answer

#include <stdio.h>
#include <stdlib.h> 
#include <string.h> 


int main() {
	//Password of Bob is "Apple" and Jim is Orange"
	char BobPassword[]="Apple";
	char JimPassword[]="Orange";
	// exchange the keys
	char temp[10];
	strcpy(temp,BobPassword);
	strcpy(BobPassword,JimPassword);
	strcpy(JimPassword,temp);


	printf("Bob password: %s\n",BobPassword);
	printf("Jim password: %s\n",JimPassword);




	getchar();
	getchar();


	return 0;
}





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS