当我的UserLogin页面加载时,我想检查用户数据库,如果它不存在,或者无法读取,我想将它指向NewUser页面.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
CheckForUser();
if (UserExists == false)
this.Frame.Navigate(typeof(NewUser));
}
Run Code Online (Sandbox Code Playgroud)
问题是它永远不会导航NewUser,即使我评论出这个if条件.
这 是问题..
这就是我到目前为止所做的
#include <stdio.h>
#include <math.h>
long int factorial(int m)
{
if (m==0 || m==1) return (1);
else return (m*factorial(m-1));
}
double power(double x,int n)
{
double val=1;
int i;
for (i=1;i<=n;i++)
{
val*=x;
}
return val;
}
double sine(double x)
{
int n;
double val=0;
for (n=0;n<8;n++)
{
double p = power(-1,n);
double px = power(x,2*n+1);
long fac = factorial(2*n+1);
val += p * px / fac;
}
return val;
}
int main()
{
double x;
printf("Enter angles …Run Code Online (Sandbox Code Playgroud) 我刚刚开始学习指针,经过大量添加和删除之后,*我将输入的字符串转换为大写的代码终于可以工作了..
#include <stdio.h>
char* upper(char *word);
int main()
{
char word[100];
printf("Enter a string: ");
gets(word);
printf("\nThe uppercase equivalent is: %s\n",upper(word));
return 0;
}
char* upper(char *word)
{
int i;
for (i=0;i<strlen(word);i++) word[i]=(word[i]>96&&word[i]<123)?word[i]-32:word[i];
return word;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,在调用我发送的函数时word,它本身就是一个指针,那么char* upper(char *word)为什么我需要使用*word?
它是指向指针的指针吗?另外,有char*没有因为它返回一个指向字符/字符串的指针?
请向我说明这是如何工作的。
单击ImageView后,我需要全屏打开图像,就像带有一个图像的图库一样!我该怎么做?
我有两个二维数组,我不知道为什么或如何,每个数组中的两个元素的地址重合.这是源代码:
#include <stdio.h>
int main()
{
int i,j,m,n,o,p,*ptr;
printf("Enter dimension of 1st matrix: ");
scanf("%d * %d",&m,&n);
printf("Enter dimension of 2nd matrix: ");
scanf("%d * %d",&o,&p);
int *a[m][n];
int *b[o][p];
if (n!=o) return 0;
printf("\nEnter 1st matrix:\n");
for (i=0;i<m;i++)
for (j=0;j<n;j++)
{ printf("%d ",(a+i*(n-1)+i+j)); scanf("%d",(a+i*(n-1)+i+j)); }
printf("\nEnter 2nd matrix:\n");
for (i=0;i<o;i++)
for (j=0;j<p;j++)
{ printf("%d ",(b+i*(p-1)+i+j)); scanf("%d",(b+i*(p-1)+i+j)); }
/*Printing the matrices*/
puts("");puts("");
for (i=0;i<m;i++)
{for (j=0;j<n;j++)
{ ptr = (a+i*(n-1)+i+j);
printf(" %d ",*ptr); } puts("");}puts("");
for (i=0;i<o;i++)
{for (j=0;j<p;j++)
{ …Run Code Online (Sandbox Code Playgroud) 我只是C的初学者.
我正在尝试制作一个简单的程序来按升序排列用户输入的数字.我已经找到了解决方案,但无法理解为什么我的其他代码不起作用:(
-------------------------------------------------------------------------
working code:
-------------------------------------------------------------------------
#include <stdio.h>
int main()
{
int i,j,num[10];
printf("Enter 10 numbers\n");
for (i=0;i<10;i++)
{scanf("%d",&num[i]);}
for (i=0;i<9;i++)
{
for (j=i+1;j<10;j++)
{
if (num[i]>num[j])
{
num[i]+=num[j];
num[j]=num[i]-num[j];
num[i]=num[i]-num[j];
}
}
}
printf("The numbers in ascending order are:");
for (i=0;i<10;i++)
{
printf(" %d",num[i]);
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
-------------------------------------------------------------------------
code that won't work:
-------------------------------------------------------------------------
#include <stdio.h>
int main()
{
int i,j,num[10];
printf("Enter 10 numbers\n");
for (i=1;i<=10;i++)
{scanf("%d",&num[i]);}
for (i=1;i<10;i++)
{
for (j=i+1;j<=10;j++)
{
if (num[i]>num[j])
{
num[i]+=num[j];
num[j]=num[i]-num[j];
num[i]=num[i]-num[j]; …Run Code Online (Sandbox Code Playgroud) 我正在学习指针,现在卡住了一个小时,用这段代码,
#include <stdio.h>
int determinant(int **mat) /* int mat[3][3] works fine.. int *mat[3] doesn't.. neither does int *mat[] */
{
int det;
int a=*(*(mat+0)+0); // printf("\n%d",a);
int b=*(*(mat+0)+1); // printf("\n%d",b);
int c=*(*(mat+0)+2); // printf("\n%d",c);
int d=*(*(mat+1)+0); // printf("\n%d",d);
int e=*(*(mat+1)+1); // printf("\n%d",e);
int f=*(*(mat+1)+2); // printf("\n%d",f);
int g=*(*(mat+2)+0); // printf("\n%d",g);
int h=*(*(mat+2)+1); // printf("\n%d",h);
int i=*(*(mat+2)+2); // printf("\n%d",i);
det = a*(e*i-h*f) - b*(d*i-g*f) + c*(d*h-e*g);
return det;
}
int main()
{
int mat[3][3];
int i,j;
printf("Enter the 3 X 3 …Run Code Online (Sandbox Code Playgroud) c ×5
function ×3
pointers ×3
arrays ×2
android ×1
c# ×1
fullscreen ×1
gallery ×1
imageview ×1
navigation ×1
string ×1
trigonometry ×1
uppercase ×1