Posts

Showing posts with the label program

GENERAL:String

//============================================================================ // Name        : pi.cpp // Author      : Rohit More //============================================================================ #include <iostream> #include <string.h> using namespace std; int main() {     char * string2="C++ Programming With Parazhar";     int n = strlen(string2);     for(int i=1;i<n;i++)     {         cout.write(string2,i);         cout<<"\n";     }     for(int i=n;i>n;i++)     {         cout.write(string2,i);         cout<<"\n";     }     cout.write(string2,n);     cout<<"\n";     re...

GENERAL:Value of PI

//============================================================================ // Name        : pi.cpp // Author      : Rohit More //============================================================================ #include <iostream> using namespace std; int main() {     float pi=22.0/7.0;     int i;     cout<<"Val of pi:";     for(i=1;i<20;i++)     {         cout.width(i+1);         cout.precision(i);         cout<<pi<<"\n";     }     return 0; } /*  * OUTPUT  * Val of pi: 3 3.1 3.14 3.143 3.1429 3.14286 3.142857 3.1428571 3.14285707 3.142857075 3.1428570747 3.14285707474 3.142857074738 3.1428570747375 3.14285707473755 3.142857074737549 3.1428570747375488 3.1428...

OSA:System information c++

#include <iostream> #include <sys/utsname.h> using namespace std; int main(){ struct utsname sysinfo; uname(&sysinfo); cout << "System Name: "<<sysinfo.sysname<<endl; cout << "Host Name: "<<sysinfo.nodename<<endl; cout << "Release(Kernel) Version: "<<sysinfo.release<<endl; cout << "Kernel Build Timestamp: "<<sysinfo.version<<endl; cout << "Machine Arch: "<<sysinfo.machine<<endl; cout << "Domain Name: "<<sysinfo.domainname<<endl; return 0; }