所以我有一些语法错误说:
Error C2143 syntax error: missing ';' before '* '
Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int
Error C2238 unexpected token(s) preceding ';'
Error C2143 syntax error: missing ';' before '*'
Run Code Online (Sandbox Code Playgroud)
所有这些都在:
#pragma once
#include "World.h"
class Organism
{
protected:
int strength;
int initiative;
int age, x, y;
char sign;
World *world; //line that makes errors
public:
Organism(World*,int,int);
virtual ~Organism();
virtual void action() = 0;
virtual void collision() = 0;
virtual char getSign() …Run Code Online (Sandbox Code Playgroud) 为什么会出现此错误?
“ ADA.FLOAT_IO”不是预定义的库单元
我以前从未在ADA中写过任何东西,只是我不知道自己在做什么。我使用GNAT进行编译。
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Float_IO; use Ada.Float_IO;
with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;
procedure MAIN is
A,B,C:Float;
W : Float;
Re, Im:Float;
begin
Put("Give A");Get(A);
Put("Give B");Get(B);
Put("Give C");Get(C);New_Line;
if A=0.0 then
Put_Line("It is not second degree polynomial");
else
W:=B*B - 4.0*A*C;
Re:=B/(2.0*A); Im:=Sqrt(Abs(W))/(2.0*A);
Put("dif = "); Put(W);New_Line;
if W<0.0 then
Put_Line("Complex ");
Put("x1 = ");Put(-Re);Put(" -j ");Put(Im);Put(" ");
Put("x2 = ");Put(-Re);Put(" +j ");Put(Im);New_Line;
else
Put_Line("Real");
Put("x1 = ");Put(-Re-Im);Put(" ");
Put("x2 = ");Put(-Re+Im);
end if;
end if; …Run Code Online (Sandbox Code Playgroud) 如何使用按钮制作简单的网格视图?我已经尝试了最明显的解决方案,但它不起作用。教程真的很糟糕(对我来说),而且简单的解决方案不起作用。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="155.5dp"
android:numColumns="2"
android:padding="10dp"
android:layout_marginBottom="68.0dp"
android:background="#009967">
<Button
android:text="Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button1" />
</GridView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)