1 Replies - 9926 Views - Last Post: 27 January 2013 - 08:30 PM

#1 ZacCarlson  Icon User is offline

  • D.I.C Head

Reputation: -7
  • View blog
  • Posts: 146
  • Joined: 08-October 12

Help w/ :error: expected '=', ',', ';', 'a

Posted 27 January 2013 - 07:22 PM

I'm getting these errors:

n1.c:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'System'
n1.c:4: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'System'
n1.c:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
n1.c:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
n1.c: In function 'main':
n1.c:14: error: 'composites' undeclared (first use in this function)
n1.c:14: error: (Each undeclared identifier is reported only once
n1.c:14: error: for each function it appears in.)
n1.c:21: error: 'primes' undeclared (first use in this function)

Guide me/help me fix these please.


#include<stdio.h>
#include<stdbool.h>
using System;
using System.Collections;
int maxValue = 1000;
int k = 2; // Just ignore 1 and make it 2
ArrayList<Integer> composites = new ArrayList<Integer>();
ArrayList<Integer> primes = new ArrayList<Integer>();
int main() {
  size(100, 100);
  while (k < maxValue) {
    bool notComposite = true;
        int i;
        for ( i = 0; i < composites.size(); i++) {
      if (k == composites.get(i)) {
        notComposite = false;
        break;
      }
    }
    if (notComposite) {
      primes.add(k);
      int markCoefficient = 2;
      int newComposite = markCoefficient*k;
      while (newComposite < maxValue) {
        composites.add(newComposite);
        markCoefficient++;
        newComposite = markCoefficient*k;
      }
    }
    k++;
  }
  println("Primes");
  println(primes);
  println("Composites");
  println(composites);
      return 0;
      }



Is This A Good Question/Topic? 0
  • +

Replies To: Help w/ :error: expected '=', ',', ';', 'a

#2 ZacCarlson  Icon User is offline

  • D.I.C Head

Reputation: -7
  • View blog
  • Posts: 146
  • Joined: 08-October 12

Re: Help w/ :error: expected '=', ',', ';', 'a

Posted 27 January 2013 - 08:30 PM

Remove this post please.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1