初学者在这里。所以我编写了一个代码来提示用户输入两个不同的数字。 if语句表示如果数字是< = 0,它应该提示用户输入满足它的不同数字。但是,每次输入正数时,这个不正确的提示仍会出现。有点烦人。谁能让我走上正确的道路?
IActuator
答案 0 :(得分:0)
你犯了一些错误。你把大小作为一个字符串,大小应该作为一个int,因为它是一个数字。字符串基本上是一个字符数组。
Error 1 error: cannot find symbol
android.support.v4.content.Loader.OnLoadCanceledListener
symbol: class OnLoadCanceledListener
location: class Loader
xxx\obj\Debug\android\src\mono\android\support\v4\content\Loader_OnLoadCanceledListenerImplementor.java 8 36 xxx
Error 6 error: cannot find symbol
android.support.v4.view.MenuItemCompat.OnActionExpandListener
symbol: class OnActionExpandListener
location: class MenuItemCompat
xxx\obj\Debug\android\src\mono\android\support\v4\view\MenuItemCompat_OnActionExpandListenerImplementor.java 8 41 xxx
Error 7 error: cannot find symbol
android.support.v4.view.OnApplyWindowInsetsListener
symbol: class OnApplyWindowInsetsListener
location: package android.support.v4.view
xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.java 8 26 xxx
Error 12 error: cannot find symbol
android.support.v4.view.ViewPropertyAnimatorListener
symbol: class ViewPropertyAnimatorListener
location: package android.support.v4.view
xxx\obj\Debug\android\src\mono\android\support\v4\view\ViewPropertyAnimatorListenerImplementor.java 8 26 xxx
Error 13 error: cannot find symbol
android.support.v4.view.ViewPropertyAnimatorUpdateListener
symbol: class ViewPropertyAnimatorUpdateListener
location: package android.support.v4.view
xxx\obj\Debug\android\src\mono\android\support\v4\view\ViewPropertyAnimatorUpdateListenerImplementor.java 8 26 xxx
Error 10 error: cannot find symbol
private native android.support.v4.view.WindowInsetsCompat n_onApplyWindowInsets (android.view.View p0, android.support.v4.view.WindowInsetsCompat p1);
symbol: class WindowInsetsCompat
location: package android.support.v4.view
xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.java 32 128 xxx
Error 11 error: cannot find symbol
private native android.support.v4.view.WindowInsetsCompat n_onApplyWindowInsets (android.view.View p0, android.support.v4.view.WindowInsetsCompat p1);
symbol: class WindowInsetsCompat
location: package android.support.v4.view
xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.java 32 40 xxx
Error 8 error: cannot find symbol
public android.support.v4.view.WindowInsetsCompat onApplyWindowInsets (android.view.View p0, android.support.v4.view.WindowInsetsCompat p1)
symbol: class WindowInsetsCompat
location: package android.support.v4.view
xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.java 27 118 xxx
Error 9 error: cannot find symbol
public android.support.v4.view.WindowInsetsCompat onApplyWindowInsets (android.view.View p0, android.support.v4.view.WindowInsetsCompat p1)
symbol: class WindowInsetsCompat
location: package android.support.v4.view
xxx\obj\Debug\android\src\mono\android\support\v4\view\OnApplyWindowInsetsListenerImplementor.java 27 32 xxx
Error 2 error: package android.support.v4.media.session.MediaSessionCompat does not exist
android.support.v4.media.session.MediaSessionCompat.OnActiveChangeListener
xxx\obj\Debug\android\src\mono\android\support\v4\media\session\MediaSessionCompat_OnActiveChangeListenerImplementor.java 8 54 xxx
Error 3 error: package android.support.v4.os.CancellationSignal does not exist
android.support.v4.os.CancellationSignal.OnCancelListener
xxx\obj\Debug\android\src\mono\android\support\v4\os\CancellationSignal_OnCancelListenerImplementor.java 8 43 xxx
Error 4 error: package android.support.v4.view.ActionProvider does not exist
android.support.v4.view.ActionProvider.SubUiVisibilityListener
xxx\obj\Debug\android\src\mono\android\support\v4\view\ActionProvider_SubUiVisibilityListenerImplementor.java 8 41 xxx
Error 5 error: package android.support.v4.view.ActionProvider does not exist
android.support.v4.view.ActionProvider.VisibilityListener
xxx\obj\Debug\android\src\mono\android\support\v4\view\ActionProvider_VisibilityListenerImplementor.java 8 41 xxx
Error 14 error: package android.support.v4.widget.SwipeRefreshLayout does not exist
android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener
xxx\obj\Debug\android\src\mono\android\support\v4\widget\SwipeRefreshLayout_OnRefreshListenerImplementor.java 8 47 xxx
答案 1 :(得分:0)
此
size = (char) str;
不如何将字符串转换为整数。我不完全确定你为什么会这么想。
这是将字符串转换为整数的最常用方法:
#include <stdlib.h>
size = atoi(str);
你在评论中提到它虽然没有用。我的猜测是因为你使用了没有原型的函数(即你没有包含stdlib.h
),但是函数失败的原因有很多。
然而,正如您已经知道的那样(因为您稍后使用过),scanf
可以直接接收整数值。您实际上不需要进行任何转换。
scanf("%d", &size);