Click here to Skip to main content
15,868,054 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

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