public class goods
}
public class seller
else
}public void changegoods(goods goods,string str)}}
#endregion
}public class buyer
}if (i < shoppingcar.goodsname.length)
}public void endbuy(buyer buyer,goods goods)
}public class taobao
}console.write("商品名稱:");
console.writeline(goods[i].name);
console.write("商品**:");
console.writeline(goods[i].price);
console.write("商品型別:");
console.writeline(goods[i].type);
console.write("商品描述:");
console.writeline(goods[i].information);
break;
}i++;}}
public void showgoods(string str, goods goods)}}
}public class shoppingcar}}
}public void endbuy(buyer buyer,goods goods)
if (goodsname[i] == goods[a].name)
else }}
}console.writeline("本次購物結束,剩餘"+buyer.money+"元錢");}}
class program
goods[0] = new goods("手機", 1000f, " "," ");
goods[1] = new goods("手1機", 1000f, " ", " ");
goods[2] = new goods("手2機", 1000f, " ", " ");
goods[3] = new goods("手3機", 1000f, " ", " ");
goods[4] = new goods("手4機", 1000f, " ", " ");
console.writeline("商品有");
for (int i = 0; i < goods.length; i++)
buyer buyer = new buyer();
console.writeline("今天帶了多少錢呢?");
buyer.money = float.parse(console.readline());
taobao taobao = new taobao();
shoppingcar shoppingcar = new shoppingcar();
buyer.shoppingcar = shoppingcar;
while (start)
break;
case "2":
break;
case "3":
console.clear();
console.writeline("要加入購物車的名字");
console.writeline("要加入購物車的型號");
for (int i = 0;iif (goods[i].name == console.readline() && goods[i].type == console.readline())
}break;
case "5":
return;
default:
console.writeline("輸入錯誤資訊,請重新開始");
break;
}
break;
case "3":
console.clear();
shoppingcar.endbuy(buyer,goods);
return;
case "4":
console.clear();
shoppingcar.showgoods(goods);
break;
default:
console.clear();
console.writeline("輸入錯誤資訊,請重新開始");
break;}}
}}
我的C語言入門到精通之路 day05
指標 5.3.1記憶體與指標 1.函式名就是函式首位址。2.乙個程式載入記憶體,資料都有位址。外掛程式就是呼叫函式,修改資料。3.函式就是 變數就是資料。4.記憶體讀寫速度快,斷電就沒有了,容量比較小,但是速度比較快。5.高階伺服器,讀寫很頻繁的檔案全部放在記憶體。5.3.2記憶體位址 1.32位計...
C語言學習日記Day05函式的宣告
函式宣告 extern 返回值型別 函式名 引數列表 關鍵字externa可以省略 extern int add01 int a,int b intadd01 int a,int b 宣告 就像是給乙個程式的標準 intmain 函式定義 在乙個專案中 函式的名字是唯一的 intadd01 int ...
Day2 簡單的c語言 1 3 1 4
今天從兩個例題中get到啦 話不多說開始 例1 3 從鍵盤上輸入任意乙個數,輸出該數的平方根,輸出寬度佔7位,並保留兩位小數。include include intmain 7.2是附加格式說明符,表示輸出資料寬度佔7位,並保留兩位小數。float double區別 double精度更高,能儲存數值...