Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions C++/m1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ class Solution
public:
bool isPalindrome(string s)
{
int i = 0, j = s.size();

int i = 0, j = s.size()-1;
while (i < j)
{
if (s[i++] != s[j--])
Expand Down
7 changes: 4 additions & 3 deletions C++/m3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#include<iostream>
using namespace std;

char string1[80];
char *initialize() {
char string[80];

// string = "hello"
char* ptr = string;
char* ptr = &string1[0];
return ptr;
}

Expand All @@ -17,6 +17,7 @@ void do_something_with(char* myval){
main() {
cout << "enter value for myval" << endl;
char *myval = initialize();
cout<<"Address is "<<myval<<endl;
cin >> *myval;
cout << "Variable intialized" << endl;
do_something_with(myval);
Expand Down
Binary file added C++/m3.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion C++/m6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include<string>

int main(){
std :: string s = "Hello World";
std :: string s = "Hello World!";

for(int i=0;i < s.length(); i++){
s[i] = toupper(s[i]);
Expand Down
Binary file added C++/m6.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion C++/s1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using namespace std;
int reverse(int x) {
long r=0;
while(x){
r=r*10+x/10;
r=r*10+x%10;
x=x/10;
}
return r;
Expand Down
Binary file added C++/s1.exe
Binary file not shown.
1 change: 0 additions & 1 deletion C++/s3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ void ineedj(void) {
}

main() {
int j;
j = foo(i);
ineedj();
}
Binary file added C++/s3.exe
Binary file not shown.
Binary file added C++/s4.exe
Binary file not shown.
17 changes: 12 additions & 5 deletions C++/s5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ using namespace std;
int main(void){
string string1 = "Hello";
string string2 = "Horld";

if (string1 == string2)
cout << "Equal";
else
cout << "Not Equal";
int i, flag=1;
for(i=0;i<5;i++)
{
if (string1[i] != string2[i])
flag=0;
}
if(flag==0)
{
cout<<"Not eual";
}
else
cout<<"Eual";
}
Binary file added C++/s5.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion Python/s1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
letter_count += 1

print("Letters:", letter_count)
print("Digits:", digit_count)
print("Digits:", digit_count)
4 changes: 2 additions & 2 deletions Python/s4.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
def is_power_of_two(n):
if n <= 0:
return False
return (n & (n-1)) == 1
return (n & (n-1)) == 0


num = 69
num = 5
if is_power_of_two(num):
print(num, "is a power of 2")
else:
Expand Down
8 changes: 4 additions & 4 deletions Python/s5.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Program: How are you doing?

answer1 = input("Are you enjoying Vashisht? ([Y]es/[N]o) ")
if answer1.lower() == "y" or "yes":
if answer1.lower() == "y" or answer1.lower()=="yes":
print("That's great! We hope you're having fun hunting for bugs.")
elif answer1.lower() == "n" or "no":
elif answer1.lower() == "n" or answer1.lower()=="no":
print(":( We're sorry to hear that. We hope you'll have fun soon.")
else:
print("404 Not Found!")

print()

answer2 = input("Do you want me to print bugs for all Python files? ;) ([Y]es/[N]o) ")
if answer2.lower() == "y" or "yes":
if answer2.lower() == "y" or answer2.lower()=="yes":
print("Nice try :P")
elif answer2.lower() == "n" or "no":
elif answer2.lower() == "n" or answer2.lower()=="no":
print("That's the spirit!")
else:
print("404 Not Found!")