Code that needs to be modified:
#include <stdio.h>
#include <math.h>
int main(void)
{
FILE * fileout;
int ix,iy,it,Nt;
double newV[31][21],V[31][21],x,dx,y,dy;
fileout=fopen("buckbeak.dat","w");
printf("\nEnter number of iterations ");
scanf("%d",&Nt);
dx=0.10;
dy=0.10;
for(iy=0; iy<21; iy=iy+1)
{
for(ix=0; ix<31; ix=ix+1)
{
V[ix][iy]=0.0;
}
}
iy=20;
for (ix=0;ix<31; ix=ix+1)
{
V[ix][iy]=8.0;
}
for (it=0; it<Nt;it=it+1)
{
for(iy=1; iy<20;iy=iy+1)
{
for(ix=1;ix<30; ix=ix+1)
{
newV[ix][iy]=0.25*(V[ix+1][iy]+V[ix-1][iy]+V[ix][iy+1]+V[ix][iy-1]);
}
}
for (iy=1; iy<20; iy=iy+1)
{
for(ix=1; ix<30; ix=ix+1)
{
V[ix][iy]=newV[ix][iy];
}
}
}
for (iy=0;iy<21;iy=iy+1)
{
y=dy*iy;
for (ix=0;ix<31;ix=ix+1)
{
x=dx*ix;
fprintf(fileout,"\n %8.4lf %8.4lf %8.4lf",x,y,V[ix][iy]);
}
fprintf(fileout,"\n");
}
printf("\n V at box center %12.6lf", V[15][10]);
fclose(fileout);
printf("\n");
return 0;
}
Question: In wht array elements are the values of the potential on the boundaries stored? Why do the ix loops go to 30 or 31 . while the iy loops go to 20 or 21? Why do some of the ix loops go to 31 and others to 30
******* Please make sure you answer all the questions asked and please do it 100%correctly. Please write neat and very clear that way i can be able to read and understand what is being said. The language used is C.
for any query leave a comment here ill get back to you as soon as possible :)
PLEASE DO NOT FORGET TO LEAVE A THUMBS UP! THANKS! :)
Code that needs to be modified: #include <stdio.h> #include <math.h> int main(void) { FILE * fileout; int ix,iy,it,Nt; double newV[31][21],V[31][21],x,dx,y,dy; fileout=fopen("buckbeak....
Convert this code from C to C++
include <stdio.h> include <locale.h> void filtre (double x. double yll, double yol, int , int N) int Nn-10000 int main) setlocale (LC ALL,") double x(Nm) , y [ Nm],yo Nml®(0.0); int m; FILE dosyal-fopen("D:/veri/673.txtr FILE dosya2-fopen("D:/veri/data2.txt int i-0 while( feof (dosyal)) fscanf (dosyal, " ",xi sytil) fclose (dosyal) int Nij printf("Pencere Genişligi scanf() 3 filtre(x,y.Yo,m,N) for(int k-0keNkt+)fprintf (dosya2, 10.41 10.411 0.41fn",x[k],y[k].yo[k]) fclose(dosya2) void filtre (double x double y. double yoll, int m, int...
convert this code from C to C++
include <stdio.h> include <locale.h> void filtre (double x. double yll, double yol, int , int N) int Nn-10000 int main) setlocale (LC ALL,") double x(Nm) , y [ Nm],yo Nml®(0.0); int m; FILE dosyal-fopen("D:/veri/673.txtr FILE dosya2-fopen("D:/veri/data2.txt int i-0 while( feof (dosyal)) fscanf (dosyal, " ",xi sytil) fclose (dosyal) int Nij printf("Pencere Genişligi scanf() 3 filtre(x,y.Yo,m,N) for(int k-0keNkt+)fprintf (dosya2, 10.41 10.411 0.41fn",x[k],y[k].yo[k]) fclose(dosya2) void filtre (double x double y. double yoll, int m, int...
#include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> int main(void) { /* Type your code here. */ int GetNumOfNonWSCharacters(const char usrStr[]) { int length; int i; int count = 0; char c; length=strlen(usrStr); for (i = 0; i < length; i++) { c=usrStr[i]; if ( c!=' ' ) { count++; } } return count; } int GetNumOfWords(const char usrStr[]) { int counted = 0; // result // state: const char* it = usrStr; int inword = 0; do switch(*it)...
Code that needs to be modified: #include #include #include int main() { int i,N,x; unsigned int seed; double R; printf("\nEnter number of iterations and seed"); printf("\n"); scanf("%i %u", &N,&seed); srand(seed); for(i=0;i { R=(double)rand()/RAND_MAX; if (R<0.5) x=x+1; else x=x-1; } printf("Final location is "); printf("%d",x); printf("\n"); } Question: Write a code that generates N pairs of random numbers. Call the first member of each pair x and the second member y. Count how many of the N pairs obey x^2+y^2<1. Call...
Please answer the questions below about the following code segment in C: int x, y, z int *ix, *iy, *iz; char *c "Hello"; x10; ?- 20; z=30; iz = &z; x = z + *IZ; 200 t 30?130 2200; 1. What is the value of "ix? 2, What is the value of *iy? 3. What is the value of *iz? 4. What is the value of c[0]? 5. What is the value of c[strlen(c) - 1]?
C++ Can someone please help with this code... even when the players number isnt a winning number the program always says the player wins: #include <stdio.h> #include <time.h> //main function int main() { //seeding a random number srand(time(0)); //define the arrays for the wagered, winning amount, percent amount double amounts[7] = { 1, 5, 10, 20, 50, 100, 1000 }; double payoff[7] = { 100, 500, 1000, 2000, 5000, 10000, 100000 }; double percent[7] = { 0.01, 0.05, 1, 2,...
need the code in .c format
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <math.h> struct _cplx double re, im; // the real and imaginary parts of a complex number }; typedef struct _cplx Complex; // Initializes a complex number from two real numbers Complex CmplxInit(double re, double im) Complex z = { re, im }; return z; // Prints a complex number to the screen void CmplxPrint(Complex z) // Not printing a newline allows this to be printed in the middle of...
lab3RGB.c file:
#include <stdio.h>
#define AlphaValue 100
int main() {
int r, g,b;
unsigned int rgb_pack;
int r_unpack, g_unpack,b_unpack;
int alpha = AlphaValue;
printf("enter R value (0~255): ");
scanf("%d",&r);
printf("enter G value (0~255): ");
scanf("%d",&g);
printf("enter B value (0~255): ");
scanf("%d",&b);
while(! (r<0 || g<0 || b <0) )
{
printf("A: %d\t", alpha); printBinary(alpha); printf("\n");
printf("R: %d\t", r); printBinary(r); printf("\n");
printf("G: %d\t", g); printBinary(g); printf("\n");
printf("B: %d\t", b); printBinary(b); printf("\n");
/* do the packing */
//printf("\nPacked: value %d\t", rgb_pack); printBinary(rgb_pack);printf("\n");...
c
program
void funcint x, int *y) { 1. Whof the Rings gical ASA All of the above 1.0.2.4) What will be the out of the de int, pat) A) 10 12 (1.03.2) What will be the output of the following int , printf(d, a,b); A) & B) 17 11.12 D) 17.25 13. (L032) An array is a group of memory locations related by the fact that they all have my name and pe A) different different B) same, different...
the code in the photo for this I.V.P
dy/dx= x+y. y(0)=1
i need the two in the photo
thank you
New folder Bookmarks G Google dy/dx x+y, y(0)=1 2 h Exact Solution 1.8 Approximate Solution Mesh Points 1.6 -Direction Fied 1.4 1.2 1 0.8 04 0.2 0.3 0.1 0 X CAUsersleskandara\Desktop\New folder emo.m EDITOR PUBLISH VEW Run Section FILE NAVIGATE EDIT Breakpoints Run Run and FL Advance Run and Advance Time BREAKPOINTS RUN 1 - clear all 2 clc 3-...