Click here to Skip to main content
15,885,985 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: MAPI error MAPI_E_NOT_SUPPORTED problem Pin
Victor Nijegorodov8-Sep-22 22:00
Victor Nijegorodov8-Sep-22 22:00 
GeneralRe: MAPI error MAPI_E_NOT_SUPPORTED problem Pin
jur20028-Sep-22 23:07
jur20028-Sep-22 23:07 
GeneralRe: MAPI error MAPI_E_NOT_SUPPORTED problem Pin
Victor Nijegorodov8-Sep-22 23:25
Victor Nijegorodov8-Sep-22 23:25 
AnswerRe: MAPI error MAPI_E_NOT_SUPPORTED problem Pin
Randor 8-Sep-22 23:24
professional Randor 8-Sep-22 23:24 
GeneralRe: MAPI error MAPI_E_NOT_SUPPORTED problem Pin
jur20029-Sep-22 0:44
jur20029-Sep-22 0:44 
GeneralRe: MAPI error MAPI_E_NOT_SUPPORTED problem Pin
Randor 9-Sep-22 1:10
professional Randor 9-Sep-22 1:10 
AnswerRe: MAPI error MAPI_E_NOT_SUPPORTED problem Pin
Gerry Schmitz9-Sep-22 15:54
mveGerry Schmitz9-Sep-22 15:54 
QuestionProblem creating an array of "class" Pin
Roberto64_Ge6-Sep-22 10:25
Roberto64_Ge6-Sep-22 10:25 
Hi
I'm getting problem running the sw I attach here below. I am trying to make an array of a certain class.

In the header I have the class then a .cpp with public methods. In the main I'm doing this:

C++
<pre>#include "Anagrafica.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

void cod (anagrafica arr,string n, string c,int chiave)
{ arr.codifica(n,c,chiave); }
 
void decod (anagrafica arr)
{ arr.decodifica(); }
 
int main()
{
ifstream file; 
file.open("input.txt"); 
int N;
string n,c;

int chiave;
int chiave_input;
file>>N; 
cout<<N<<endl;

anagrafica* Arr_ = new anagrafica[N];

for (int i = 0; i < N; i++)
{
	Arr_[i] = anagrafica("ciao", "miao", i*25);
}

for (int i=0; i<N; i++)
{
 file>>chiave;
 file>>n;
 file>>c;
 //Arr_[i].setChiave(chiave);
 //cod(Arr_[i],n,c,chiave);
}
for (int i=0; i<N; i++)
	//Arr_[i].stampa();

cout<<"inserire un valore intero"<<endl;
cin>>chiave_input;

}


here is header

C++
<pre>#include<iostream>
#include<string>
using namespace std;

 class anagrafica
 {
   private:
   
   string nome_cifrato;  
   string cognome_cifrato;   
   int chiave_cifratura;
   
   public : 
   
   anagrafica(string ="", string ="", int=0); //costruttore
   
   void setNome(string );
   
   void setCognome(string );
   
   string getNome();
   
   string getCognome();
   
   void codifica(string , string , int );
   
   void decodifica();
   
   void setChiave(int);
    
   int getChiave();
   
   void stampa();
   
   
 };


I do not attach the public method here because problem is before using methods.
Problem occurs when I create instance of array of class anagrafica. At the end that is not an array. Program does not raise any exception in the for with i from 1 to N. As if array was of dimension N. But it isn't.
I tried also with the double pointer like this
C++
<pre>anagrafica** Arr_ = new anagrafica*[N];

for (int i = 0; i < N; i++)
{
	Arr_[i] = new anagrafica("ciao", "miao", i*25);
}

but Arr_ is of only 1 element,
the first no other

Confused | :confused:
SuggestionRe: Problem creating an array of "class" Pin
Mircea Neacsu6-Sep-22 10:38
Mircea Neacsu6-Sep-22 10:38 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge6-Sep-22 10:57
Roberto64_Ge6-Sep-22 10:57 
AnswerRe: Problem creating an array of "class" Pin
Richard MacCutchan7-Sep-22 5:10
mveRichard MacCutchan7-Sep-22 5:10 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 3:55
Roberto64_Ge8-Sep-22 3:55 
GeneralRe: Problem creating an array of "class" Pin
Greg Utas8-Sep-22 4:24
professionalGreg Utas8-Sep-22 4:24 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 4:32
Roberto64_Ge8-Sep-22 4:32 
GeneralRe: Problem creating an array of "class" Pin
Greg Utas8-Sep-22 6:59
professionalGreg Utas8-Sep-22 6:59 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 23:57
mveRichard MacCutchan8-Sep-22 23:57 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 4:32
mveRichard MacCutchan8-Sep-22 4:32 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 4:36
Roberto64_Ge8-Sep-22 4:36 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 4:53
mveRichard MacCutchan8-Sep-22 4:53 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:18
Roberto64_Ge8-Sep-22 5:18 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:25
mveRichard MacCutchan8-Sep-22 5:25 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:27
Roberto64_Ge8-Sep-22 5:27 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:17
mveRichard MacCutchan8-Sep-22 5:17 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:26
Roberto64_Ge8-Sep-22 5:26 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:38
mveRichard MacCutchan8-Sep-22 5:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.