In a network of m > 1 agents, constrained consensus means that all m agents reach an agreement on a specific value of some quantity via local interactions while their states are restricted to lie in different closed convex sets. This paper formulates and solves two generalized versions of the basic constrained consensus problem. The first version deals with the case when the constraint set of each agent is complex so that the projection operation on the whole constraint set is computationally expensive or even prohibitive. The second version models the constrained flocking problem in which each agent can only sense the current headings of its neighbors and independently updates its heading at times determined by its own clock. Two constrained consensus algorithms are proposed for the two versions. Both are guaranteed to reach a consensus under appropriate assumptions.