Click here to Skip to main content
15,501,250 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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
MemberRoberto64_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
MemberRoberto64_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 
GeneralRe: Problem creating an array of "class" Pin
Roberto64_Ge8-Sep-22 6:26
MemberRoberto64_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
MemberRoberto64_Ge8-Sep-22 6: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 6:37
MemberRoberto64_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
MemberRoberto64_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
MemberRoberto64_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
MemberRoberto64_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
MemberMember 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
mveGreg Utas5-Sep-22 7:44 
QuestionRe: How can do it in c++? Pin
CPallini5-Sep-22 21:50
mveCPallini5-Sep-22 21:50 
QuestionCombining QProcess, qterminal and bluetoothctl...in C++ code Pin
Member 149687714-Sep-22 6:28
MemberMember 149687714-Sep-22 6:28 
AnswerRe: Combining QProcess, qterminal and bluetoothctl...in C++ code Pin
Mircea Neacsu4-Sep-22 7:05
mvaMircea Neacsu4-Sep-22 7:05 
GeneralRe: Combining QProcess, qterminal and bluetoothctl...in C++ code Pin
Member 149687714-Sep-22 7:38
MemberMember 149687714-Sep-22 7:38 
GeneralRe: Combining QProcess, qterminal and bluetoothctl...in C++ code PinPopular
Gerry Schmitz4-Sep-22 9:21
mveGerry Schmitz4-Sep-22 9:21 
AnswerRe: Combining QProcess, qterminal and bluetoothctl...in C++ code Pin
Richard MacCutchan4-Sep-22 22:37
mveRichard MacCutchan4-Sep-22 22: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.