Help!!

Hi,I got an error when I try compiling the code

**** Internal Builder is used for build ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o program4.o ..\program4.cpp
..\program4.cpp: In function 'int main()':
..\program4.cpp:72:18: error: expected primary-expression before '%' token
Build error occurred, build is stopped

Please assist me,thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
 //A red seed will grow into a flower when planted in soil
//temperatures above 75 degrees, other wise it will grow into
//a mushroom.Assuming the temperature meets the conditions
//for a growing flower,planting the red see in wet soil
//will produce  a sun flower and planting the red seed in dry
//soil will produce dandelion.
//a blue seed will grow into a flower when planted in soil
//temperatures ranging from 60 to 70 otherwise it will grow
//into a mushroom.Assuming the temperature meets the conditions
//for growing a flower,planting the blue seed in wet soil will
//produce a dandelion and planting the blue seed in dry soil
//will produce a sun flower.
#include <iostream>
#include <string>
using namespace std;

int main()
{



	//Get seed color
	string seedColor = "";
	cout << "Enter the seed color(red/blue) : \n";
	cin >> seedColor;

	//Get temp
	int temp = 0;
	cout << "Enter the temperature(F) : \n";
	cin >> temp;



	//Get the soil moisture
	string soilMoisture = "";
	cout << "Enter the soil moisture ( wet or dry) : \n";
	cin >> soilMoisture;

	//If red seed
	if(seedColor == "red")
	{

		// If temp >=75
		if(temp >= 75)
		{

			//If soil is wet
		if(soilMoisture == "wet")
		{


		//Output sunflower
			cout << "A sunflower will grow.\n";
		}
		//If soil is dry
		if(soilMoisture == "dry")
		{

			//Output dandelion
			cout << "A dandelion will grow.\n";
		}
	}
		//Otherwise

		  //output mushroom
		cout << "A mushroom will grow.\n";
	}

	//If blue seed
	if(seedColor == "blue")
	{
		//If temp is between 60 and 70
		if(temp >= 60 %% temp <=70)
		{
			// If the soil is wet
			if(soilMoisture == "wet"){



				//Output dandelion
				cout << "A dandelion will grow.\n";
			}
		//If the soil is dry

			if(soilMoisture == "dry")
			{

			//Output sunflower
				cout << "A sunflower will grow,\n";
			}
		}
		//Otherwise
		else
		{
			//Output mushroom
			cout << "A mushrom will grow.\n";
		}
	}
}

Last edited on
if(temp >= 60 %% temp <=70) What do ointend to do there?
Nevermind,silly me.

Used %% instead of &&
@ MiiniPaa yeah realized that,thanks tho!
Topic archived. No new replies allowed.