I am trying to make a program that will start up iexplore and open facebook. But I am having trouble identifying!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include "stdafx.h"
#include <iostream>
usingnamespace std;
int main()
{
cout << "Select which website you would like to go to.\n";
cout << "1. Facebook\n";
char f;
cin >> f;
return 0;
}
I will also be making it to go to different sites but I don't know what to identify. I know I will be using the if/else.
Example: if (1==1)
else ()
Being f=go to youtube and d being go to facebook. But I don't know how to identify 1 with www.youtube.com. I am just learning :).
if you do it with numbers as input - like 1 for Faceboook, 2 for Myspace , and so on - you may better use the switch-case-control
1 2 3 4 5 6 7 8 9 10 11
switch(number)
{
case 1:
//Do your code for Facebook here
break;
case 2:
//Do your code for Mysapce here
break;
default:
//Do You Code For Anything else here
};
and what do you min, with identifying?...
what references/tutorials are u using for learning c/c++?...
For do your code here I would put:
system("start c:\\progra~1\\intern~1\\iexplore.exe http://facebook.com\n");
??
And what I mean by identifying is I thought I would have to assign 1 to youtube. So like int 1 = youtube and like int 2 = facebook so I could make if/else statements so like if (1==1) then if they selected 1, it would go to like youtube. But I realized now I would have to put something like if (Input == 1) Or something. I am not good with these if/else statements right now. :P
I am going to try that code out. Thanks.
Edit:
error C2065: 'number' : undeclared identifier
error C2050: switch expression not integral
error C2065: 'default' : undeclared identifier