Start New Discussion within our Software Development Community

It doesn't run! Can you help me please?
Devc++ compiles it, and also launch the exe file, but it stops after the second for cycle! Why? :D

#include <iostream>
#include <string>
using namespace std;

int main()
    int N,i,z;
    cout<<"Digitare il umero di caratteri che contengono il nome ";
    string cod[N],nome[N];
    int ch[N];
    cout<<"Nome in codice "<<endl;
    cout<<"Chiave di lettura "<<endl;
    for (i=0;i<N;i++)
    for (i=0;i<N;i++)
    system ("Pause");
    return 0;}

well, i can tell you some problems with it.

your string variables make a reeference to an array but it has a value of zero.

int i;
std::string string1[i]; //error: i is not initiliazed, and assumed to be zero
int j = 1;
std::string string2[j]; //no error. arrays must have a value of 1 or greater

you variable nome, is referenced but does not have a definition anywhere. ambiguous
variables are not supported.

ch cannot determine it's value. in order to alleviate this you have to get the value of n, before ch is define or initialize it as one and replace it later in the code.

if you fix those errors it should work.

This article has been dead for over six months. Start a new discussion instead.