Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Return Values From Functions Not Returning

$
0
0
So I made a function displayed below and the 2 values with not return. I put it in my main funtion and it wouldn't cause any errors but it wouldn't return the values. I have tryed removing 1 of the values they have the correct value.
and i don't want to use the pair command. I have looked for around 1 - 2 hours.

#include <iostream>
#include <string>
#include <ctime>


	using std::string;
	
	
	int Fire(int A, int B, int C, int D, string Atk, string Def, bool Dead) 
	{
	int Kills;

	using std::cout;
	using std::endl;
	
	
		
		srand((unsigned int)time(0));
		C =  (rand() % C) + A | 2;

		

	if		(C < 25)
	{
		cout<<Atk<<" misses "<<Def<<endl;
	
			Kills = 0;

			
	}	
	
	else if	(C > 90)
	{
		cout<<Atk<<" gets a perfect hit on "<<Def<<endl;

			Kills = A;

			
	}

	else 
	{
		cout<<Atk<<" gets a hit on "<<Def<<endl;

			Kills = A / 2;

			
	
	}
		D = D - Kills;

	
		if (D <= 0)
		{
			cout<<Atk<<" has killed "<<Def<<endl;

				bool Dead = true;

		}
		
		else
		{
			cout<<Def<<" has "<<D<<" men left after the attack"<<endl;
		}

		
	

	return D, C;

	}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>