View the step-by-step solution to:

#include <iostream> #include <stdio.

#include <iostream>
#include <stdio.h>
using namespace std;

int runRule(int a, int b, int c)
{
	int rule[8] = { 0,1,1,1,1,1,1,0 };
	
	int d = (a << 2 | (b << 1) | (c));

	return(rule[d]);
}

int main()
{
	int bs = 64;
	int i[64];
	int j[bs];
	int *cs;
	int *ns;
	int *ss;

	cs = i;
	ns = j;

	int a = 0;
	int b = 0;

	for (a = 0; a < bs; a++)
	{
		i[a] = 0;
	}
	i[32] = 1;

	for (b = 0; b < 100; b++)
	{
		for (a = 0; a < bs; a++)
		{
			if (a == 0)
			{
				ns[a] = runRule(cs[bs - 1], cs[0], cs[1]);
			}
			else if (a == bs - 1)
			{
				ns[a] = runRule(cs[bs - 2], cs[bs - 1], cs[0]);
			}
			else
			{
				ns[a] = runRule(cs[a - 1], cs[a], cs[a + 1]);
			}
		}

		for (a = 0; a < bs; a++)
		{
			//printf("%s",cs[a]==0?"..":"[]");
			printf("%s", cs[a] == 0 ? " " : "*");
		}
		printf("n");

		ss = cs;
		cs = ns;
		ns = ss;
	}
}

int j[bs];

This is line 18.


This is my code, but i cant debug it with visual studio, The line 18 said the expression did not evaluate a constant, how do i fix it?

Top Answer

In C++ programming, whenever size of the array is defined with some variable whose value is initialized, it is compulsory to... View the full answer

1.png

Sign up to view the full answer

Other Answers

Here is a detailed explanation... View the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online