An example of code to demonstrate SWITCH statements
editor:[ https://t.me/PROGRAMINGLANGUAGES1]
#include <iostream>
using namespace std;
int day = 4;
switch (day) {
case 1:
cout << "Monday";
break;
case 2:
cout << "Tuesday";
break;
case 3:
cout << "Wednesday";
break;
case 4:
cout << "Thursday";
break;
case 5:
cout << "Friday";
break;
case 6:
cout << "Saturday";
break;
case 7:
cout << "Sunday";
break;
}
// Outputs "Thursday" (day 4)
source: [https://www.w3schools.com/CPP/cpp_switch.asp]
editor:[ https://t.me/PROGRAMINGLANGUAGES1]
#include <iostream>
using namespace std;
int day = 4;
switch (day) {
case 1:
cout << "Monday";
break;
case 2:
cout << "Tuesday";
break;
case 3:
cout << "Wednesday";
break;
case 4:
cout << "Thursday";
break;
case 5:
cout << "Friday";
break;
case 6:
cout << "Saturday";
break;
case 7:
cout << "Sunday";
break;
}
// Outputs "Thursday" (day 4)
source: [https://www.w3schools.com/CPP/cpp_switch.asp]
The evaluated value this c++ statement is __» x = 2 % 2 + 2 * 2 - 2 / 2;
Anonymous Quiz
18%
A— (304/100)
18%
B—- 0
62%
c—-3
2%
D—- (202/50)
LTC2.Which of the following is incorrect method to subtract a value of 1 from the variable 'i' ?
Anonymous Quiz
14%
i -= 1;
39%
i -= i - 1;
15%
i += -1;
20%
i--;
12%
none of the above
@ltc
ASCII{American standard code for information exchange}
#include<iostream>
using namespace std;
int main()
{
for(char ch='A';ch<='Z';ch++)
{
cout<<ch<<"="<<(int)ch<<"\n";
}
}
A =65
B=66
C = 67
D = 68
E = 69
F = 70
.
.
.
.
.
.
X = 88
Y = 89
Z = 90
👉👉https://t.me/PROGRAMINGLANGUAGES1
ASCII{American standard code for information exchange}
#include<iostream>
using namespace std;
int main()
{
for(char ch='A';ch<='Z';ch++)
{
cout<<ch<<"="<<(int)ch<<"\n";
}
}
A =65
B=66
C = 67
D = 68
E = 69
F = 70
.
.
.
.
.
.
X = 88
Y = 89
Z = 90
👉👉https://t.me/PROGRAMINGLANGUAGES1
How to find the factorial of any number using for loop.? That accept a num from user
#include<iostream>
using namespace std;
int main()
{
int no,f=1;
cout<<"Enter any number\n";
cin>>no;
for(int i=1;i<=no;i++)
{
f=f*i;
}
cout<<"Factorial="<<f;
}
<tryOnYourCompiler>
👉👉
https://t.me/PROGRAMINGLANGUAGES1
#include<iostream>
using namespace std;
int main()
{
int no,f=1;
cout<<"Enter any number\n";
cin>>no;
for(int i=1;i<=no;i++)
{
f=f*i;
}
cout<<"Factorial="<<f;
}
<tryOnYourCompiler>
👉👉
https://t.me/PROGRAMINGLANGUAGES1
—- is a user controlled jump statement which is controlled by the user.
Anonymous Quiz
60%
break;
13%
goto
15%
jump
6%
defualt
6%
stop
for(m;n;l); which steps are indicated by letters?
Anonymous Quiz
6%
(m==increase/decrease; n==initialization; l== condition)
13%
(m==initialization; n== increase/decrease;l==condition)
63%
(m ==initialization; n ==condition; l ==increase/decrease)
3%
(m==increase/decrease; n==condition; l ==initialization)
16%
none of the above
cpp-for-loop @ltc.pdf
122.8 KB
Nice pdf for -cpp looping
- nested looping
- and more
👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿
👉🏿https://t.me/PROGRAMINGLANGUAGES1
👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿
- nested looping
- and more
👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿👇🏿
👉🏿https://t.me/PROGRAMINGLANGUAGES1
👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿👆🏿
👍1
👆👆👆👆👆👆🏿👆🏿👆🏿
🈸 c++droid app
Good IDE. For c++ tutors on your mobile or tablet
https://t.me/PROGRAMINGLANGUAGES1
🈸 c++droid app
Good IDE. For c++ tutors on your mobile or tablet
https://t.me/PROGRAMINGLANGUAGES1
👍1
Watch "Introduction to For Loops in Python (Python Tutorial #5)" on YouTube
https://youtu.be/OnDr4J2UXSA
https://youtu.be/OnDr4J2UXSA
gcm_and_lcm.cpp
835 B
A program to find LCM and GCD of two integers.. use code::block or Falcon++