Swapping won't work
Anyone knows why this code won't work?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
#include <string.h>
using namespace std;
void sw(char nom[],char pom[]);
int main()
{
char str[40], stra[40];
cout<<"Enter string A:- ";
cin.getline(str,40);
cout<<endl<<"Enter string B:- ";
cin.getline(stra,40);
sw(str, stra);
return 0;
}
void sw(char nom[], char pom[]){
swap(nom,pom);
cout.write(nom,40);
cout.write(pom,40);
}
|
Last edited on
You're not actually calling sw().
Topic archived. No new replies allowed.