all links i typed in open all at once, HELP!!!

im tryin to make a own "siri" cind of thing, so i made some liks this program can open, but when i type a command like "open weather", all links open at the same time.

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
#include <iostream>

#include <Windows.h>

#include <string>

using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */






int main() 
{
	//----------------------------------------------------------CMDS
	int cmd = 0;
	//----------------------------------------------------------URLs
	string weather = "https://www.ventusky.com/"; //url
	string blocket = "https://www.blocket.se/"; //url
	string email = "https://www.outlook.com/"; //url
	string bikroy = "https://www.bikroy.com"; //url
	//----------------------------------------------------------inputs
	string input = "nothing";
	
	cout << "Hi i am your new and own assistent, my name is alex\n";
	
	Sleep(2000);
	
	while(true){
			
	cout << "what do you want me to do?" << endl;
	
	getline(cin, input);
	
	cout << "you said \n" << input;
	
if (input == "open weather\n" || "whats the weather like\n" || "whats the weather like today?\n"){
	ShellExecute(NULL, "open", weather.c_str(), NULL, NULL, SW_SHOWNORMAL); 
}
if (input == "open blocket\n"){
	ShellExecute(NULL, "open", blocket.c_str(), NULL, NULL, SW_SHOWNORMAL); 
}
if (input == "open email\n" || "check my email\n" || "do i have any new mails?\n" || "check my mail\n" || "open mail\n"){
	ShellExecute(NULL, "open", email.c_str(), NULL, NULL, SW_SHOWNORMAL); 
}
if (input == "open bikroy\n" || "whats new on bikroy\n?"){
	ShellExecute(NULL, "open", bikroy.c_str(), NULL, NULL, SW_SHOWNORMAL); 
}

}

return 0;
}

what am i doing wrong?
input == "open weather\n" || "whats the weather like\n" || "whats the weather like today?\n")This is wrong.

input == "open weather\n" || input == "whats the weather like\n" || input == "whats the weather like today?\n")This is right.
Last edited on
i tried that but now theres a new problem, what ever i type in, it allways opens the same url, outlook?
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
#include <iostream>

#include <Windows.h>

#include <string>

using namespace std;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */






int main() 
{
	//----------------------------------------------------------CMDS
	int cmd = 0;
	//----------------------------------------------------------URLs
	string weather = "https://www.ventusky.com/"; //url
	string blocket = "https://www.blocket.se/"; //url
	string mail = "https://www.outlook.com/"; //url
	string bikroy = "https://www.bikroy.com"; //url
	//----------------------------------------------------------inputs
	string input = "nothing";
	
	cout << "Hi i am your new and own assistent, my name is alex\n";
	
	Sleep(2000);
	
	while(true){
			
	cout << "what do you want me to do?\n" << endl;
	
	getline(cin, input);
	
	cout << "you said \n" << input;
	
if (input == "open weather\n" || input == "whats the weather like\n" || input == "whats the weather like today?\n"){
	ShellExecute(NULL, "open", weather.c_str(), NULL, NULL, SW_SHOWNORMAL); 
}
if (input == "open blocket\n"){
	ShellExecute(NULL, "open", blocket.c_str(), NULL, NULL, SW_SHOWNORMAL); 
}
if (input == "open email\n" || input =="check my email\n" || input =="do i have any new mails?\n" || input =="check my mail\n" || "open mail\n"){
	ShellExecute(NULL, "open", mail.c_str(), NULL, NULL, SW_SHOWNORMAL); 
}
if (input == "open bikroy\n" || input == "whats new on bikroy\n?"){
	ShellExecute(NULL, "open", bikroy.c_str(), NULL, NULL, SW_SHOWNORMAL); 
}

}

return 0;
}
Line 46
The problem of line 46 is the missing input ==

Remove the \n from your strings because getline(...) does not store it in input.
Topic archived. No new replies allowed.