I installed, according to a few YT tutorials, the VSCode editor. I also installed the C/C++ extensions, theme and the Code runner extension, and I downloaded from sourceforge the Mingw64 folder, moved it to C:\ and then added the Path to the system variables. Despite this, the compiler can compile c but not c++ (gives me an error like "exited with code -1" or something). I searched up on google and found nothing about this. Does anybody have a solution?
I also tried changing the compiler from gcc.exe to g++.exe in the C/C++ configuration. Nothing changed.
I'm going to put the code I wrote under here. Please ignore the language, I'm not English :)
C code:
#include<stdio.h>
int main(){
int eta;
printf("Ciao, inserisci eta: ");
scanf("%d", &eta);
printf("L'eta e' %d", eta );
return 0;
}
C++ code:
#include<iostream>
using namespace std;
int main(){
float importo, rendcat, incA=0, incB=0, incD=0, mediaAg=0, mediaEd=0, sommaAg=0, sommaEd=0;
char cat, tipo, ered, nome;
int percrendcat, aliq, coeffimm, erF=0, erAg=0, erEd=0;
do{
importo=0;
rendcat=0;
percrendcat=0;
aliq=0;
coeffimm=0;
cout<<"\nInserire il nome (iniziale): ";
cin>>nome;
if(nome!='*'){
do{
cout<<"\nInserire la rendita catastale: ";
cin>>rendcat;
if(rendcat<=0){
cout<<"\nInserire una rendita maggiore di 0.";
}
}while(rendcat<=0);
do{
cout<<"\nInserire la categoria di immobile: "
<<"\n[a/A] Categoria A"
<<"\n[b/B] Categoria B"
<<"\n[d/D] Categoria D\n";
cin>>cat;
switch(cat){
case 'a':
case 'A':{
coeffimm=120;
break;
}
case 'b':
case 'B':{
coeffimm=140;
break;
}
case 'd':
case 'D':{
coeffimm=60;
break;
}
default:{
cout<<"\nOpzione non valida. ";
break;
}
}
}while(cat!=65&&cat!=66&&cat!=68&&cat!=97&&cat!=98&&cat!=100);
do{
cout<<"\nInserire il tipo di immobile: "
<<"\n[a/A] Casa"
<<"\n[b/B] Terreno agricolo"
<<"\n[c/C] Terreno edificabile\n";
cin>>tipo;
switch(tipo){
case 'a':
case 'A':{
percrendcat=5;
break;
}
case 'b':
case 'B':{
percrendcat=25;
coeffimm=90;
erAg++;
break;
}
case 'c':
case 'C':{
percrendcat=30;
coeffimm=95;
erEd++;
break;
}
default:{
cout<<"\nOpzione non valida. ";
break;
}
}
}while(tipo!='a'&&tipo!='A'&&tipo!='b'&&tipo!='B'&&tipo!='c'&&tipo!='C');
do{
cout<<"\nL'eredit"<<char(133)<<" proviene da: "
<<"\n[a/A] Genitore"
<<"\n[b/B] Fratello"
<<"\n[c/C] Altro parente\n";
cin>>ered;
switch(ered){
case 'a':
case 'A':{
aliq=5;
break;
}
case 'b':
case 'B':{
aliq=7;
erF++;
break;
}
case 'c':
case 'C':{
aliq=9;
break;
}
default:{
cout<<"\nOpzione non valida. ";
break;
}
}
}while(ered<65||(ered>67&&ered<97)||ered>99);
importo=(((rendcat+(rendcat*percrendcat/100))*coeffimm)*aliq)/100;
cout<<"\nNome del cittadino (iniziale): "<<nome;
cout<<"\nImporto da pagare: "<<importo<<" euro.";
cout<<"\nTipologia di bene selezionata: "<<tipo;
cout<<"\nValore dell'aliquota applicata: "<<aliq<<"\n";
switch(cat){
case 'a':
case 'A':{
incA=incA+importo;
break;
}
case 'b':
case 'B':{
incB=incB+importo;
break;
}
case 'd':
case 'D':{
incD=incD+importo;
break;
}
}
switch(tipo){
case 'b':
case 'B':{
sommaAg=sommaAg+importo;
mediaAg=sommaAg/erAg;
break;
}
case 'c':
case 'C':{
sommaEd=sommaEd+importo;
mediaEd=sommaEd/erEd;
break;
}
}
cout<<"\nNumero di cittadini che hanno ricevuto eredit"<<char(133)<<" da fratello: "<<erF;
cout<<"\nIncasso dello stato per immobili di categoria A: "<<incA<<" euro.";
cout<<"\nIncasso dello stato per immobili di categoria B: "<<incB<<" euro.";
cout<<"\nIncasso dello stato per immobili di categoria D: "<<incD<<" euro.";
cout<<"\nIl valore medio delle tasse pagate sui terreni agricoli ammonta a "<<mediaAg<<" euro.";
cout<<"\nIl valore medio delle tasse pagate sui terreni edificabili ammonta a "<<mediaEd<<" euro.";
}
}while(nome!='*');
cout<<"\n3B software, grazie per aver scelto i nostri programmi.";
return 0;
}