Stuff, Things
This commit is contained in:
parent
7c6fcb78b3
commit
957e7d3ed0
29
.vscode/launch.json
vendored
Normal file
29
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "gcc.exe build and debug active file",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
],
|
||||
"preLaunchTask": "gcc.exe build active file"
|
||||
}
|
||||
]
|
||||
}
|
20
.vscode/tasks.json
vendored
20
.vscode/tasks.json
vendored
@ -1,6 +1,4 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
@ -24,6 +22,24 @@
|
||||
],
|
||||
"group": "build"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "gcc.exe build active file",
|
||||
"command": "C:\\MinGW\\bin\\gcc.exe",
|
||||
"args": [
|
||||
"-g",
|
||||
"${file}",
|
||||
"-o",
|
||||
"${fileDirname}\\${fileBasenameNoExtension}.exe"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "C:\\MinGW\\bin"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
],
|
||||
"group": "build"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "gcc.exe build active file",
|
||||
|
@ -1,13 +1,33 @@
|
||||
/*
|
||||
* Student: S.K. Soekhlal
|
||||
* Number: 4860632
|
||||
* Assignment: 3.4
|
||||
* Assignment: 3.6
|
||||
*/
|
||||
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<math.h>
|
||||
|
||||
int discriminant(){
|
||||
double x1real,x2real,ximag;
|
||||
extern int a,b,c; /*Variables stored in another file*/
|
||||
|
||||
static float discriminant(){
|
||||
return (pow(b,2)-(4*a*c)); /*Calculate Discriminant */
|
||||
}
|
||||
|
||||
void abc(){
|
||||
float D = discriminant();
|
||||
if (D>0){
|
||||
x1real = ((-b+sqrt(D))/(2.0*a));
|
||||
x2real = ((-b-sqrt(D))/(2.0*a));
|
||||
ximag = 0;
|
||||
}
|
||||
else if(D<0){
|
||||
x1real = -b/(2.0*a);
|
||||
x2real = x1real;
|
||||
ximag = (sqrt(-D)/(2.0*a));
|
||||
}
|
||||
else{
|
||||
x1real = -b/(2.0*a);
|
||||
x2real = x1real;
|
||||
ximag = 0;
|
||||
}
|
||||
}
|
33
Assignment 7/main.c
Normal file
33
Assignment 7/main.c
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Student: S.K. Soekhlal
|
||||
* Number: 4860632
|
||||
* Assignment: 4.3
|
||||
*/
|
||||
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<math.h>
|
||||
|
||||
int main(){
|
||||
int m,n,i,j,c;
|
||||
double price[100] = {0};
|
||||
int matrix[100][100];
|
||||
scanf("%d",&n);
|
||||
for(i = 0; i<n; i++){
|
||||
scanf("%lf", &price[i]);
|
||||
}
|
||||
scanf("%d",&m);
|
||||
for(j = 0; j<m; j++){
|
||||
for (c = 0; c < n; c++){
|
||||
scanf("%d",&matrix[c][j]);
|
||||
}
|
||||
}
|
||||
for (j = 0; j<m; j++){
|
||||
float total = 0;
|
||||
for(c = 0; c < n; c++){
|
||||
total += matrix[c][j]*price[c];
|
||||
}
|
||||
printf("%.2f\n", total);
|
||||
}
|
||||
return 0;
|
||||
}
|
17
Test/main.c
Normal file
17
Test/main.c
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Student: S.K. Soekhlal
|
||||
* Number: 4860632
|
||||
* Assignment: 3.4
|
||||
*/
|
||||
|
||||
#include<stdlib.h>
|
||||
#include<stdio.h>
|
||||
|
||||
int main(){
|
||||
int a,b;
|
||||
a = 7 % 4;
|
||||
printf("%d\n",a);
|
||||
b = (a += 2) +5;
|
||||
printf("%d %d\n",a,++b);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user