+ 3
Please can anyone tell me what is wrong with my program? it is showing some random output.
#include <iostream> using namespace std; void convert(char a[]) //to convert lowercase to uppercase { for(int i =0; a[i]!='\0';i++) { if (a[i]>=97 && a[i]<=122) { a[i] = a[i]-32; } } for(int i =0;a[i]!='/0';i++) // prints within the function after converting { cout<<a[i]; } } int main() { char a[100]; cout<<"enter string";cin.getline(a,100); convert(a); // error - displays random symbols,letters,etc. return 0; }
4 Antworten
+ 5
you can see my solution on this, i hope that it help you...
https://code.sololearn.com/c4c5GrKbL2f6/?ref=app
+ 2
Thanks
+ 1
@Vukan thanks for the initiative but i don't want to use the string header. Plus it seems you tried it without using functions. can you check my program as it should work fine if the logic is correct. in this case the logic is fine yet it still isnt working. I need to know why. Please can you see through this.