Thread: array not displaying values

  1. #1
    Registered User
    Join Date
    Sep 2011

    array not displaying values

    #include <iostream>
    using namespace std;
    const int MAX=100;
    int elems[MAX]={1,2,3};
    int card=3;
    void Rem(const int e);
    void Rem(const int e) {
    	for (int i=0; i<card; i++) {
    		if (elems[i]==e) {
    			for (;i<(card-1); i++) {
    int main() {
    	for (int i; i<card; i++) {
    		cout << elems[i];
    this doesnt display anything. wats wrong

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    I notice that in main, you did not initialise i.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Sep 2011
    Quote Originally Posted by laserlight View Post
    I notice that in main, you did not initialise i.
    THank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Displaying Values...
    By vailant in forum C Programming
    Replies: 35
    Last Post: 01-21-2010, 06:59 PM
  2. Replies: 12
    Last Post: 04-12-2009, 05:49 PM
  3. Displaying highest and lowest values
    By beastofhonor in forum C++ Programming
    Replies: 3
    Last Post: 10-29-2006, 08:24 PM
  4. Displaying values from one class in another...
    By Dan17 in forum C++ Programming
    Replies: 2
    Last Post: 02-03-2006, 07:36 AM
  5. need some advice on displaying values
    By rEtard in forum Windows Programming
    Replies: 7
    Last Post: 06-16-2005, 09:55 AM