I want to write a program which reads all the
x'es from my input. Can anyone find the mistake
in my code?
I work from a book: Sofware engineering in C. If
anyone else is working with this book, it'd be nice
if you'd tell me
/* Chapter 4 Exercise 3 */
#include <stdio.h>
#include <iostream>
int main ()
{
int count_x = 0, i = 0;
char c;
char d[256];
puts ("Enter text. Include a dot ('.') in a sentence to exit:");
do {
c=getchar();
d[i]=c;
i++;
} while (c != '.');
i=0;
while (i<256)
{
if (d[i]='x')
{
count_x++;
}
i++;
}
printf("Het amount of x'es is: %d \n ", count_x);
system("pause>nul");
return 0;
}