Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Player authored and Player committed Sep 14, 2016
1 parent a09c1b3 commit 8c8fb4f
Show file tree
Hide file tree
Showing 12 changed files with 225 additions and 0 deletions.
Binary file modified C Practice/.vscode/.BROWSE.VC.DB
Binary file not shown.
Binary file modified C Practice/.vscode/.BROWSE.VC.DB-shm
Binary file not shown.
Binary file modified C Practice/.vscode/.BROWSE.VC.DB-wal
Binary file not shown.
41 changes: 41 additions & 0 deletions C Practice/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch",
"type": "cppdbg",
"request": "launch",
"program": "enter program name, for example ${workspaceRoot}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true,
"linux": {
"MIMode": "gdb"
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb"
}
},
{
"name": "C++ Attach",
"type": "cppdbg",
"request": "attach",
"program": "enter program name, for example ${workspaceRoot}/a.out",
"processId": "${command.pickProcess}",
"linux": {
"MIMode": "gdb"
},
"osx": {
"MIMode": "lldb"
},
"windows": {
"MIMode": "gdb"
}
}
]
}
18 changes: 18 additions & 0 deletions C Practice/1-34.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include<stdio.h>
void hello_world(void)
{
printf("Hello World!\n");
}

void three_hellos(void)
{
int counter;
for(counter=1;counter<=3;counter++)
hello_world();
}

int main(void)
{
three_hellos();
return 0;
}
11 changes: 11 additions & 0 deletions C Practice/1-35.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <stdio.h>

int main(int argc, char *argv[]) {
int len=0;
char *p=s;
while(*p!=0)
{
len++;
p++;
}
}
14 changes: 14 additions & 0 deletions C Practice/1.1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <iostream>
using namespace std;

using namespace std;
int main(int argc, char *argv[]) {
cout << "Size of char: " << sizeof(char) << endl;
cout << "Size of int: " << sizeof(int) << endl;
cout << "Size of chort int: " << sizeof(short int) << endl;
cout << "Size of long int:" << sizeof(long int) << endl;
cout << "Size of float: " << sizeof(float) << endl;
cout << "Size of double: " << sizeof(double) << endl;
cout << "Size of wchar_t : " << sizeof(wchar_t) << endl;
return 0;
}
21 changes: 21 additions & 0 deletions C Practice/1.2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <iostream>

using namespace std;
extern int a,b;
extern int c;
extern float f;

int main(int argc, char *argv[]) {
int a,b;
int c;
float f;

a=10;
b=20;
c=a+b;
cout << c << endl;
f=70.0/3.0;
cout << f << endl;

return 0;
}
7 changes: 7 additions & 0 deletions C Practice/1.3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
cout << "Hello\tWorld\n\n";
return 0;
}
79 changes: 79 additions & 0 deletions C Practice/1.4.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#include <iostream>

using namespace std;

class Box
{
public:
double length;
double breadth;
double height;
/* double getVolume(void){
return length*breadth*height;
}*/

double getVolume(void);
void setLength(double len);
void setBreadth(double bre);
void setHeight(double hei);
};

double Box::getVolume(void)
{
return length * height * breadth;
}

double Box::setLength(double len)
{
length = len;
}

double Box::setBreadth(double bre)
{
breadth = bre;
}

double Box::setHeight(double hei)
{
height = hei;
}

int main(int argc, char *argv[])
{
/* Box Box1;
Box Box2;
double volume = 0.0;
Box1.height = 5.0;
Box1.length = 6.0;
Box1.breadth = 7.0;
Box2.height = 10.0;
Box2.length = 12.0;
Box2.breadth = 13.0;
volume = Box1.height * Box1.length * Box1.breadth;
cout << "Box1's volume: " << volume << endl;
volume = Box2.height * Box2.length * Box2.breadth;
cout << "Box2's volume: " << volume << endl;
*/
Box Box1 ;
Box Box2;
double volume;

Box1.setLength(6.0);
Box1.setHeight(5.0);
Box1.setBreadth(7.0);

Box2.setLength(12.0);
Box2.setBreadth(13.0);
Box2.setHeight(10.0);

volume=Box1.getVolume();
cout << "Box1's volume is :" << volume << endl;

volume = Box2.getVolume();
cout << "Box2's volume is :" << volume << endl;

return 0;
}
31 changes: 31 additions & 0 deletions C Practice/1.5.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <iostream>

using namespace std;

class Line
{
public:
double length;
void setLength(double len);
doubel getLength;
};

double Line::getLength(void)
{
return length;
}

void Line::setLength(double len)
{
length=len;
}

int main(int argc, char *argv[]) {
Line line;

line.setLength(6.0);

cout << "Length of line :" << line.length << endl;

return 0;
}
3 changes: 3 additions & 0 deletions C Practice/1.6.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <iostream>

using namespace std;

0 comments on commit 8c8fb4f

Please sign in to comment.