Click here to Skip to main content
15,848,724 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan9-Sep-22 0:57
mveRichard MacCutchan9-Sep-22 0:57 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:32
mveRichard MacCutchan8-Sep-22 5:32 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:36
Roberto64_Ge8-Sep-22 5:36 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 5:53
mveRichard MacCutchan8-Sep-22 5:53 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:18
Roberto64_Ge8-Sep-22 6:18 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 6:25
mveRichard MacCutchan8-Sep-22 6:25 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:27
Roberto64_Ge8-Sep-22 6:27 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 6:17
mveRichard MacCutchan8-Sep-22 6:17 
I have commented out all the parts of your code that are not needed to create a simple test. The result is as follows:
C++
// header file
#include<iostream>
#include<string>
using namespace std;

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

C++
// implementation
#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(); }

anagrafica::anagrafica(string a, string b, int c) //costruttore
{
   nome_cifrato = a;  
   cognome_cifrato = b;   
   chiave_cifratura = c;
}

void anagrafica::setChiave(int a)
{
	chiave_cifratura = a;
}

// added to show the results
void anagrafica::print()
{
	cout << nome_cifrato << " " << cognome_cifrato << " " << chiave_cifratura << endl;
}

int main()
{
// ifstream file; 
// file.open("input.txt"); 
int N = 4; // create just four entries
//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] = new anagrafica("ciao", "miao", i*25);
}

for (int i = 0; i < N; i++)
{
	Arr_[i]->print();
}

// 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;

}

GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:26
Roberto64_Ge8-Sep-22 6:26 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 6:38
mveRichard MacCutchan8-Sep-22 6:38 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:43
Roberto64_Ge8-Sep-22 6:43 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:37
Roberto64_Ge8-Sep-22 6:37 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan8-Sep-22 6:45
mveRichard MacCutchan8-Sep-22 6:45 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 9:04
Roberto64_Ge8-Sep-22 9:04 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan9-Sep-22 0:37
mveRichard MacCutchan9-Sep-22 0:37 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge9-Sep-22 11:30
Roberto64_Ge9-Sep-22 11:30 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan9-Sep-22 23:00
mveRichard MacCutchan9-Sep-22 23:00 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge10-Sep-22 1:34
Roberto64_Ge10-Sep-22 1:34 
GeneralRe: Problem creating an array of "class" Pin
Richard MacCutchan10-Sep-22 1:47
mveRichard MacCutchan10-Sep-22 1:47 
QuestionHow can do it in c++? Pin
Member 157580955-Sep-22 7:07
Member 157580955-Sep-22 7:07 
GeneralRe: How can do it in c++? Pin
Richard MacCutchan5-Sep-22 7:43
mveRichard MacCutchan5-Sep-22 7:43 
AnswerRe: How can do it in c++? Pin
Greg Utas5-Sep-22 7:44
professionalGreg Utas5-Sep-22 7:44 
QuestionRe: How can do it in c++? Pin
CPallini5-Sep-22 21:50
mveCPallini5-Sep-22 21:50 
QuestionMessage Closed Pin
4-Sep-22 6:28
Member 149687714-Sep-22 6:28 
AnswerRe: Combining QProcess, qterminal and bluetoothctl...in C++ code Pin
Mircea Neacsu4-Sep-22 7:05
Mircea Neacsu4-Sep-22 7:05 

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.