tengo el siguiente codigo ,compilo y me lanza una gran cantidad de errores no se como solucionarlo el error es "el string es muy grande" ese una lista ,la voy a dejar acá abajo es raro por el hecho de que no se como solucionarlo y agrandar el string si puedo usar unsigned o algo asi para corregirlo..........................................................................................................................................................................................................................................................................................................................................................
a.cpp:59:24: warning: character constant too long for its type
#include <iostream>
#include <string>
#include <time.h>
#include <stdlib.h>
#include <windows.h>
using namespace std;
void ip_aleatory(long ip){
volatile int n1[ip];
volatile int n2[ip];
volatile int n3[ip];
volatile int n4[ip];
string IPs[ip];
string IPc[ip];
string IPa[ip];
int k = 0;
int j = 0;
int t = 0;
srand(time(NULL));
for (int i = 0; i != ip; ++i)
{
n1[i] = 0 + rand() % (255);
n2[i] = 0 + rand() % (255);
n3[i] = 0 + rand() % (255);
n4[i] = 0 + rand() % (255);
}
for (int i = 0; i < ip; ++i){
IPs[i] = to_string(n1[i]) + '.' +
to_string(n2[i]) + '.' +
to_string(n3[i]) + '.' +
to_string(n4[i]) ;
}
for (int i = 0; i <ip; ++i){
(n1[i]>=0 and n1[i]<=127) ? IPc[i]="A":IPc[i]=IPc[i];
(n1[i]>=128 and n1[i]<=191) ? IPc[i]="B":IPc[i]=IPc[i];
(n1[i]>=192 and n1[i]<=233) ? IPc[i]="C":IPc[i]=IPc[i];
(n1[i]>=224 and n1[i]<=239) ? IPc[i]="D":IPc[i]=IPc[i];
(n1[i]>=240 and n1[i]<=255) ? IPc[i]="E":IPc[i]=IPc[i];
}
for (int l = 0; l < ip; ++l){
if (IPs[i] =='127.0.0.0')
{
continue;
}
else if (IPs[i] =='0.0.0.0')
{
continue;
}
else if (IPs[i] =='3.0.0.0')
{
continue;
}
else if (IPs[i] =='15.0.0.0')
{
continue;
}
else if (IPs[i] =='56.0.0.0')
{
continue;
}
else if (IPs[i] =='10.0.0.0')
{
continue;
}
else if (IPs[i] =='192.168.0.0')
{
continue;
}
else if (IPs[i] =='172.16.0.0')
{
continue;
}
else if (IPs[i] =='100.64.0.0')
{
continue;
}
else{
IPs[i] = IPa[i];
j++;
}
}
for ( int i = 0; i < ip; ++i)
{
for ( j = i+1; i < ip; ++j)
{
if(IPs[i] == IPs[j]){
k = j;
while(k < ip){
IPs[k] = IPs[k+1];
++k;
}
--ip;
--j;
}
}
}
for (int i = 0; i < ip; ++i)
{
t += sizeof(IPs[i]);
}
cout<<"loading";
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<".";
Sleep(1000);
cout<<".";
cout<<endl;
for (int i=0;i<ip;++i){
cout <<"["<<i+1<<"]"<<"["<<IPc[i]<<"]"<< IPs[i] << '\n';
Sleep(500);
}
cout<<"clean";
Sleep(2000);
cout<<".";
Sleep(2000);
cout<<".";
Sleep(2000);
cout<<".";
system("cls");
}
void test_case(){
long ip;
cin>>ip;
ip_aleatory(ip);
}
int main (){
system("color 6");
test_case();
return 0;
}