UNEXPECTATION OUTPUT

guyss please help me..:(

this is my source code no error no warnings..but the output is not my expectation

because all i want is a simple choices appears in the scrn and when you enter "1" HERNANDEZ ARIEL
ICT PROGRAMMING INSTRUCTOR
MONDAY are will be appear.

plss help me i know it is easier to you guys..plss help me.:(



#include<iostream.h>
#include<conio.h>
#include<stdlib.h>

int main()

{

{

cout<<" CLB ICT INSTRUCTOR\n\n";

cout<<"Please Select The Number of Your Instructor :"<<endl<<"\n";

cout<<"1=HERNANDEZ,ARIEL\n 2=MACALALAD JAMES\n\n";


if ("1"){
cout<<"HERNANDEZ ARIEL\n\n";
cout<<" ICT PROGRAMMING INSTRUCTOR \n"<<endl;
cout<<"MONDAY \n"<<endl;
}
system ("cls");
if ("2"){
cout<<"MACALALAD JAMES\n\n";
cout<<" ICT COMPFUN INSTRUCTOR \n"<<endl;
cout<<"TUESDAY \n"<<endl;

}

cin.get();
return 0;
}
}
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
int main()

{

{

cout<<" CLB ICT INSTRUCTOR\n\n";

cout<<"Please Select The Number of Your Instructor :"<<endl<<"\n";

cout<<"1=HERNANDEZ,ARIEL\n 2=MACALALAD JAMES\n\n";

// 3 lines are displayed at this moment
// user input nothing!

if ("1"){
//you trying to handle user choise but user dont make it yet
//if ("1") is 'true' allways. you should make a logic exprassion like 1==2 etc
//so next 3 cout will be displayed
cout<<"HERNANDEZ ARIEL\n\n";
cout<<" ICT PROGRAMMING INSTRUCTOR \n"<<endl;
cout<<"MONDAY \n"<<endl;
//you have 6 lines displayed at this moment
}
system ("cls");
//you have a clear screan now 
if ("2"){
//if ("2") is 'true' allways
cout<<"MACALALAD JAMES\n\n";
cout<<" ICT COMPFUN INSTRUCTOR \n"<<endl;
cout<<"TUESDAY \n"<<endl;
// now you have 3 displayed lines
}

cin.get();
//you read something from screan.
return 0;
}
} 

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
#include<iostream>
#include<conio.h>
#include<stdlib.h>

using namespace std;

int main()
{
	cout<<" CLB ICT INSTRUCTOR\n\n";
	cout<<"Please Select The Number of Your Instructor\n\n";
	cout<<"1=HERNANDEZ,ARIEL\n2=MACALALAD JAMES\n\n";
//3 lines are displayed
	int choise;
	cin>>choise; //read integer from screan
//variable choise contains user number

	if (choise==1){   //if choise = 1
		cout<<"HERNANDEZ ARIEL\n\n";
		cout<<" ICT PROGRAMMING INSTRUCTOR \n"<<endl;
		cout<<"MONDAY \n"<<endl;
	}
	else if (choise==2){ //if choise = 2
		cout<<"MACALALAD JAMES\n\n";
		cout<<" ICT COMPFUN INSTRUCTOR \n"<<endl;
		cout<<"TUESDAY \n"<<endl;
	}
	else //in any other case
		cout<<"OOPS";

	system("pause"); //wait for user press any key
	return 0;
} 
Last edited on
THANK YOU SO MUCH MY DEAR .....:*
what code i can add if i want to return again in the choices and i want to choice other number without closing my program.?

pls response thank you so much..:)
you need a cycle
for( ; ; ){}(break; may be used)
or
while() {}
or
do while()
how can i put that in what part of my souce code please give me an example..:( im already a beginner i dont know how..:( please response
Topic archived. No new replies allowed.