char array

ı want to write a character array with capital letters.but there is a problem with the code.no error but no result.can u help me? thx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  #include <iostream>
using namespace std;


void buyukYap(char yazi[], char son[])
{
	int index = 0;

	while (yazi[index] != '\0')
	{
		if (yazi[index] >= 'a' && yazi[index] <= 'z')
		{
			son[index] = yazi[index] - 32;
		}
		else
		{
			son[index] = yazi[index];
			index++;
		}
	}
	son[index] = '\0';

}


int main()
{

	char yazi[] = "merhabalar";
	char son[50];

	buyukYap(yazi, son);
	cout << yazi << endl;
	cout << son << endl;


	return 0;

}
I think you mean to have line 18 outside of the if..else so that the index always increments to the next element before the next turn through the loop?
thank u very much.I did it:))
Topic archived. No new replies allowed.