This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<conio.h> | |
| void main(void){ // by zulqurnain jutt | |
| char* arr=new char[200]; // you can use pointer for longer strings | |
| printf("\n::Start Entering Your Paragraph Now::\n\t"); | |
| int i=0,j=0,NoofChars=0,Noofspaces=0,NoofStrings=0; | |
| while(arr[i]=getch()){ | |
| if(arr[i]!=13){ | |
| // escape sequence \n can't be used as '\n' in this case so use its Ascii 13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<iostream> | |
| using namespace std; | |
| int main(void){ // by zulqurnain jutt | |
| char arr[200]; // you can use pointer for longer strings | |
| cout<<"\n::Start Entering Your Paragraph Now::\n\t"; | |
| cin.getline(arr,200,'\n'); | |
| int i=0,j=0,NoofChars=0,Noofspaces=0,NoofStrings=0; | |
| for(;arr[i]!=0;i++,NoofChars++){ | |
| if(arr[i]==' '){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package basics; | |
| import java.util.*; | |
| class Basics{ // by Zulqurnain jutt | |
| public static void main(String argv[]) { | |
| String s; | |
| Scanner sc=new Scanner(System.in); | |
| System.out.print("::Start Entering Paragraph from Here::\n\t"); s=sc.nextLine(); | |
| char[] c=s.toCharArray(); | |
| System.out.print("\nTotal Character :=:"+c.length+"\nTotal Spaces :=:"+ (s.length()-s.replace(" ", "").toCharArray().length)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package basics; | |
| import java.util.*; | |
| import javax.swing.JOptionPane; | |
| class Basics { // done by Zulqurnain jutt | |
| public static void main(String[] args) { | |
| String s; | |
| int si,ei,numi; | |
| s=JOptionPane.showInputDialog(null, "\t::Starting Range::\t"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<iostream> | |
| using namespace std; | |
| int main(){ // done by Zulqurnain jutt | |
| int Number=13579; | |
| for(int i=Number,j,count=1;i!=0;count=1){ | |
| for(j=i;j!=0;j/=10,count*=10){} | |
| cout<<i<<"\n"; | |
| count/=10; | |
| i%=count; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<iostream> | |
| #include <fstream> | |
| using namespace std; | |
| int main(){ // By Zulqurnain jutt | |
| int Number,count=0,*Num; | |
| cout<<"Enter Any Integer Number :=:"; cin>>Number; cout<<"\n"; | |
| int temp=1; | |
| bool Negative=0; // if negative |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<iostream> | |
| using namespace std; | |
| /* | |
| Reason: when we are doing p[i] it is actually equall to *(p+i) , | |
| similarly when we are doing &p[i] it is equal to (p+i) so giving address, | |
| when we do &((&p[a])[b]) is it equall to (p+a+b) , p=0 so 0+a+b = a+b , | |
| i have used integer type casting because pointer p was of character type | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| using namespace std; | |
| int main() { | |
| string s; | |
| cout<<"Enter The String :=:"; getline(cin,s,'\n'); cout<<"\n"; | |
| for(int i=0;s[i]!=0;i++){ | |
| if((s[i]>=48 && s[i]<=57)||(s[i]>=65 && s[i]<=90)||(s[i]>=97 && s[i]<=122)){ | |
| cout<<s[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string.h> | |
| using namespace std; | |
| char* substring(char* s){ | |
| char* temp; | |
| int location = 0,j=0; | |
| int size = 0; | |
| for ( int i = 1; i < strlen(s) - 1; i++ ) { | |
| int left = i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string.h> | |
| using namespace std; | |
| char* Longpali(char* s){ | |
| char* temp; | |
| int location = 0,j=0; | |
| int maxsize = 0; | |
| for ( int i = 0; i < strlen(s) - 1; i++ ) { | |
| int left = i; |