I need your help pro programmers! I have an error that i can't easily resolve...
if i don't add:
std::vector<char>
then i get this message:
incompatible types of assignment of char to char[40]
if i do however type it then i get this:
two or more data types in declaration of 'main'...
here is the code:
#include <iostream>
#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <vector>
using namespace std;
std::vector<char>
int main()
{
int n,i,nvm,nvz,ntm,ntz;
float v[40],t[40],svm,svz,stm,stz,pvm,pvz,ptm,ptz,mtm,mtz,mvm,mvz;
char p[40] {'M','m','Z','z','\0'};
cout << "Unesite broj ucenika u odeljenju: ";
cin >> n;
for(i=1;i<=n;i++)
{
cout << "Unesite pol ucenika (M ili Z): ";
cin >> p;
cout << "Unesite visine ucenika: ";
cin >> v;
cout << "Unesite tezine ucenika: ";
cin >> t;
}
svm = 0;
nvm = 0;
for(i=1;i<=n;i++)
if((p = 'M') || (p = 'm'))
svm+=v;
for(i=1;i<=n;i++)
if((p = 'M') || (p = 'm'))
nvm+=1;
pvm = svm/nvm;
cout << "Prosecna visina muskih ucenika je:" << pvm <<"\n";
svz = 0;
nvz = 0;
for(i=1;i<=n;i++)
if((p = 'Z') || (p = 'z'))
svz+=v;
for(i=1;i<=n;i++)
if((p = 'Z') || (p = 'z'))
nvz+=1;
pvz = svz/nvz;
cout << "Prosecna visina zenskih ucenika je:" << pvz <<"\n";
stm = 0;
ntm = 0;
for(i=1;i<=n;i++)
if((p = 'M') || (p = 'm'))
stm+=t;
for(i=1;i<=n;i++)
if((p = 'M') || (p = 'm'))
ntm+=1;
ptm = stm/ntm;
cout << "Prosecna tezina muskih ucenika je:" << ptm <<"\n";
stz = 0;
ntz = 0;
for(i=1;i<=n;i++)
if((p = 'Z') || (p = 'z'))
stz+=t;
for(i=1;i<=n;i++)
if((p = 'Z') || (p = 'z'))
ntz+=1;
ptz = stz/ntz;
cout << "Prosecna tezina zenskih ucenika je:" << ptz <<"\n";
mvm = v[1];
for(i=2;i<=n;i++)
if(((v > mvm) && ((p = 'M') || (p = 'm'))))
mvm = v;
cout <<" Maksimalna visina muskaraca je: " <<mvm <<"\n";
mvz = v[1];
for(i=2;i<=n;i++)
if(((v > mvz) && ((p = 'Z') || (p = 'z'))))
mvz = v;
cout <<" Maksimalna visina zena je: " <<mvz <<"\n";
mtm = t[1];
for(i=2;i<=n;i++)
if(((t > mtm)) && ((p = 'M') || (p = 'm')))
mtm = t;
cout <<" Maksimalna tezina muskaraca je: " <<mtm <<"\n";
mtz = t[1];
for(i=2;i<=n;i++)
if(((t > mtz) && ((p = 'Z') || (p = 'z'))))
mtz = t;
cout <<" Maksimalna tezina zena je: " <<mtz <<"\n";
getch();
return 0;
}