Dakot 14 Light Poster

hello , whet i compile , i get these errors , but i dont know where i mistaked
g++ -Wall -o "untitled" "untitled.cpp" (in directory: /home/btwnix/Documents/Projects)
untitled.cpp: In function ‘std::string bunnynames(std::string)’:
untitled.cpp:14:14: error: no matching function for call to ‘tolower(std::string&)’
untitled.cpp:14:14: note: candidates are:
/usr/include/ctype.h:116:12: note: int tolower(int)
/usr/include/ctype.h:116:12: note: no known conversion for argument 1 from ‘std::string {aka std::basic_string<char>}’ to ‘int’
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/locale_facets.h:2602:5: note: template<class _CharT> _CharT std::tolower(_CharT, const std::locale&)
untitled.cpp:18:19: error: no matching function for call to ‘tolower(std::string&)’
untitled.cpp:18:19: note: candidates are:
/usr/include/ctype.h:116:12: note: int tolower(int)
/usr/include/ctype.h:116:12: note: no known conversion for argument 1 from ‘std::string {aka std::basic_string<char>}’ to ‘int’
/usr/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/locale_facets.h:2602:5: note: template<class _CharT> _CharT std::tolower(_CharT, const std::locale&)
untitled.cpp: In function ‘bool radioactive()’:
untitled.cpp:33:23: warning: integer overflow in expression [-Woverflow]
untitled.cpp: In function ‘std::string bunnynames(std::string)’:
untitled.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
Compilation failed.


this is my code.

#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
#include <ctype.h>

using namespace std;

string bunnynames(string x) {
	string malenames[] = {"Jorik", "Vasik" , "BugsBunny" , "DonaldDuck"};
	string femalenames[] = {"Jennifer" , "LadyGaga" , "Madonna" , "Natalie"};
	srand(time(NULL));
	string randommale, randomfemale;
	if(tolower(x) = "male") {
	randommale = malenames[rand() % (sizeof(malenames) / sizeof(malenames[0]))];
	return randommale;
	}
	else if(tolower(x) = "female")
	{
	randomfemale = femalenames[rand() % (sizeof(femalenames) / sizeof(femalenames[0]))];
	return randomfemale;
	}	
	else
	{
		cout<<"Is not a gender.";
	}
	
	
}


bool radioactive() {
	return rand() <  2 * RAND_MAX;
}
	
int main() 
{ 
	class Bunny 
	{
		public:
	string gender;
	string color;
	int age;
	string name;
	bool radioactive;
	}g, c, a ,n ,r;
	
ofstream fp("File.txt");
for(int i = 0; i <2; i++)
{
	
	cout<<endl;
	cout<<"bunny's gender: ";
	cin>>g.gender;
	fp<<g.gender<<endl;
	//-------
	cout<<"Bunny's color: ";
	cin>>c.color;
	fp<<c.color<<endl;
	//-------
	cout<<"Bunny's age (1 - 10): ";
	cin>>a.age;
	fp<<a.age<<endl;
	//-------
	string x = g.gender;
	fp<<bunnynames(x)<<endl;
	//-------
	fp<<radioactive()<<endl;
	//-------
	fp<<"---------------------------"<<endl;
	system("clear");
	
}
fp.close();
return 0;
}

can somebody help me? thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.