#include <stdio.h>
#include <stdlib.h>
struct fl{
char sub[3] = {"Math","Science","ICT"};
};
int main()
{
int i;
struct fl floatp;
for (i = 0; i < 3; ++i){
printf (" %s",floatp.sub[i]);
}
return 0;
}
我收到此错误“struct fl在第11行没有名为sub的成员”。但我确实有一个名为'sub'的成员。我做错了什么?
答案 0 :(得分:1)
你想要这个:
btnDialog = (Button) findViewById(R.id.btnDialog);
btnDialog.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
StringBuffer responseText = new StringBuffer();
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
alertDialogBuilder.setTitle("Diet Product");
responseText.append("הפריטים שנבחרו הם: \n");
for(int i=0;i<modelList.size();i++){
Models models = modelList.get(i);
if(models.isSelected()){
responseText.append("\n" + models.getName()+ " : "+models.getProtein() +"\n");
}
}
alertDialogBuilder
.setMessage(responseText.append("\n"+"לחישוב ערכים לחץ המשך " +"\n"+"או חזור לעידכון פרטים"+ "\n"))
.setCancelable(false)
.setPositiveButton("המשך", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// if this button is clicked, close current activity
//MainActivity.this.finish();
Intent intent = new Intent(getApplicationContext(),ItemActivity.class);
intent.putExtra(models.getName(),"name");
startActivity(intent);
}
})
.setNegativeButton("חזור", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alertDialog = alertDialogBuilder.create();
alertDialog.show();