Language: C++

#include <iostream>
#include <string>

using namespace std;

class Num{

	//string s0;
	//int inum;
	int N0;
	//int icase;
	int icount;
	int* pn;
	int isign;
	int isign0;
	long long itotal;
	
	
	
public:
	Num(int);
	Num();
	
	void output() const;
	void input();
	
	int checksign();
	
	int getsign0() const;
	int getN0() const;
	void sort0();
	void test() const;
	int add(int);
	long long add0();
	long long add1();
	
	~Num();
};



Num::Num(int itemp){N0=itemp;pn=new int[N0];}
Num::Num(){}


void Num::input(){
	//cout<<"inum?"<<endl;
	//cin>>inum;
	for(icount=0;icount<N0;icount++){

	//cout<<"icount="<<icount<<endl;
	cin>>pn[icount];
}

}

void Num::output() const{
	for(int icount1=0;icount1<N0;icount1++){

	//itemp=pn[icount].output();
	//cout<<"itemp="<<itemp<<endl;
	cout<<"pn["<<icount1<<"]="<<pn[icount1]<<endl;
}
	//return inum;

}	

int Num::checksign(){
	isign=0;
	isign0=0;
	
	for(icount=0;icount<N0;icount++){
if(pn[icount]<0){isign++;pn[icount]=-pn[icount]}
		else if(pn[icount]==0){isign0++;}
									}
	return isign;
}

void Num::test() const{cout<<"hogehoge"<<endl;}

void Num::sort0(){
				bool b0=1;
			while(b0==1){
				b0=0;
				//cout<<"ho0ge"<<endl;
				for(icount=0;icount<N0-1;icount++){
					if((pn[icount])>(pn[icount+1])){
												int itemp0=pn[icount];
												pn[icount]=pn[icount+1];
												pn[icount+1]=itemp0;
												b0=1;
												
												
												}
					else{}
					
				}//end for
				
				//output();
				//cout<<"b0="<<b0<<endl;
				//cout<<"-----"<<endl;
				
				}//end while
					//return 0;
					}//end function
					
					
int Num::add(int itemp){
				itotal=0;
				for(icount=itemp;icount<N0;icount++){
				
						itotal=itotal+(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				return itotal;

}

long long Num::add0(){
				itotal=0;
				for(icount=0;icount<N0;icount++){
				
						itotal=itotal+(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				return itotal;

}//end add0

long long Num::add1(){
				itotal=0;
				for(icount=1;icount<N0;icount++){
				
						itotal=itotal+(pn[icount]);
						//cout<<"hoge"<<endl;
				}
				itotal=itotal-(pn[0]);
				return itotal;

}//end add1

int Num::getsign0() const{return isign0; }
int Num::getN0() const{return N0; }		

Num::~Num(){delete [] pn;}




int main(){
	//int i0=12;
	int N0;
	//int icount;
	//int itemp;
	int isign,isign0;
	long long itotal0;
	//int isign0;
	
	
	//cout<<"N0?"<<endl;
	cin>>N0;
	
	Num n0(N0);
	n0.input();
	//n0.output();
	isign=n0.checksign();
	isign0=n0.getsign0();
	//isign0=n0.checksign0();
	
	//cout<<"isign="<<isign<<endl;
	//cout<<"isign0="<<isign0<<endl;
	//cout<<"N0="<<n0.getN0()<<endl;



	n0.sort0();
	//n0.test();
	//n0.output();
	
if(isign0!=0){

				itotal0=n0.add0();
}
else if(isign%2==1){

				itotal0=n0.add1();
}

else {

				itotal0=n0.add0();
}


			//cout<<"itotal="<<itotal0<<endl;
			cout<<itotal0<<endl;
			return 0;
}

Compiler output:
a.cc: In member function 'int Num::checksign()':
a.cc:73:48: error: expected ';' before '}' token
   73 | if(pn[icount]<0){isign++;pn[icount]=-pn[icount]}
      |                                                ^
      |                                                ;