Click here to Skip to main content
15,884,388 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 5:43
Roberto64_Ge8-Sep-22 5:43 
I attach the method file .cpp

C++
#include "Anagrafica.h"
#include <iostream>
#include <string>

using namespace std;



anagrafica::anagrafica(string name,string surname, int key)
{
 nome_cifrato=name;
 cognome_cifrato=surname;
 chiave_cifratura=key;
}

void anagrafica::setNome(string n_)
   {
   nome_cifrato=n_;
   }
void anagrafica::setCognome(string c_)
   {
   cognome_cifrato=c_;
   }

   
string anagrafica::getNome()
   {
   return nome_cifrato;
   }
string anagrafica::getCognome()
   {
   return cognome_cifrato;
   }

int anagrafica::getChiave()
{
 return chiave_cifratura;
 }

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

void anagrafica::stampa()
{
    string nom = nome_cifrato;
    string cog = cognome_cifrato;
 cout<<" nome  cifrato "<<nom;
 cout<<" cognome  cifrato "<<cog<<endl;
}


void anagrafica::codifica(string nome_chiaro, string cognome_chiaro, int chiave)
{ 
 char car;
 nome_cifrato = "";
 cognome_cifrato = "";
 for (int i=0;i <nome_chiaro.length();i++)
    {
     car = nome_chiaro[i] + chiave;
     nome_cifrato = nome_cifrato + car;
     cout<<"carattere "<<i<<" n in chiaro "<<nome_chiaro[i]<<" chiave  "<<chiave<<" cifrato "<<car<<" nome incostruzione "<<nome_cifrato<<endl;
    }
 setNome(nome_cifrato);     
 for (int i=0; i<cognome_chiaro.length();i++)
    {
     car = cognome_chiaro[i] + chiave;
     cognome_cifrato = cognome_cifrato + car;
     cout<<"carattere "<<i<<" c in chiaro "<<cognome_chiaro[i]<<" chiave  "<<chiave<<" cifrato "<<car<<" cognome incostruzione "<<cognome_cifrato<<endl;
    }
 setCognome(cognome_cifrato);   
}
   
void anagrafica::decodifica()
{ 

 char car;
 string nome_chiaro = "";
 string cognome_chiaro = "";
 for (int i=0;i <nome_cifrato.length();i++)
    {
     car = nome_cifrato[i] - chiave_cifratura;
     nome_chiaro = nome_chiaro + car;
     cout<<"carattere "<<i<<" n in cifrato "<<nome_cifrato[i]<<" chiave  "<<chiave_cifratura<<" chiaro "<<car<<" nome incostruzione "<<nome_chiaro<<endl;
    }
 cout<<" nome in chiaro "<<nome_chiaro;     
 for (int i=0; i<cognome_cifrato.length();i++)
    {
     car = cognome_cifrato[i] - chiave_cifratura;
     cognome_chiaro = cognome_chiaro + car;
     cout<<"carattere "<<i<<" c in cifrato "<<cognome_cifrato[i]<<" chiave  "<<chiave_cifratura<<" chiaro "<<car<<" cognome incostruzione "<<cognome_chiaro<<endl;
    }
 cout<<" cognome in chiaro "<<cognome_chiaro<<endl; 
}


I can't understand where is the error.
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 
GeneralMessage Closed Pin
4-Sep-22 6:38
Member 149687714-Sep-22 6:38 
GeneralRe: Combining QProcess, qterminal and bluetoothctl...in C++ code PinPopular
Gerry Schmitz4-Sep-22 8:21
mveGerry Schmitz4-Sep-22 8:21 
AnswerRe: Combining QProcess, qterminal and bluetoothctl...in C++ code Pin
Richard MacCutchan4-Sep-22 21:37
mveRichard MacCutchan4-Sep-22 21:37 

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.