Witam, mam takie coś
#include "Header.h"
void korekta(char *tekst_in, char *tekst_out)
{
cin.getline (tekst_in,6);
int i_out=0;
cout<<strlen(tekst_in)<<endl;
for(int i=0; i<strlen(tekst_in)+1; i++)
{
if (tekst_in[i-1]==' ' && tekst_in[i]==' ')
continue;
else if(tekst_in[i-1]==' ' && tekst_in[i]==',')
tekst_out[i_out-1]=',';
else if(tekst_in[i-1]==' ' && tekst_in[i]=='.')
tekst_out[i_out-1]='.';
else
{
tekst_out[i_out]=tekst_in[i];
i_out++;
}
}
for(int i=0; i<i_out; i++)
cout<<tekst_out[i];
}
i wywołuje ją w ten sposób:
#include "Header.h"
char tekst_in[6];
char tekst_out[6];
korekta(tekst_in, tekst_out);
Plik nagłówkowy:
#ifndef Header_h
#define Header_h
#include<iostream>
using namespace std;
void korekta(char*tekst_in, char*tekst_out);
#endif
Mam takie błędy: too many initializers
'korekta' : redefinition; previous definition was 'function'
'initializing' : cannot convert from 'char [6]' to 'int'
missing type specifier - int assumed. Note: C++ does not support default-int
Nie za bardzo wiem jak sobie z tym poradzić, pomocy!