波浪屿的海角声

文章 评论 浏览 29

波浪屿的海角声 2025-02-14 11:16:59

确定可以。听起来您想使用 sumif 结合了减法。

对于您的情况,公式可能是:
lt; y/n>,<条件的

=<启动值> -sumif( &

  • 范围A列中的代码>或 n 在B列中的A1到A10
  • 数值,从B1到B10,
  • ,则将在B1中减去B1中的值
  • 如果A1为 Y 启动值是

100

Sure you can. Sounds like you want to use SUMIF combined with a subtraction.

For your case, the formula will likely be:
=<start value>-SUMIF(<range of Y/N>, <condition>, <range of values>)

e.g. for a sheet with:

  • either Y or N in column A, from A1 to A10
  • numeric values in column B, from B1 to B10
  • where the value in B1 is to be subtracted if A1 is Y
  • the start value is 100

You would use =100-SUMIF(A1:A10, "=Y", B1:B10)

从数字减去if statment

波浪屿的海角声 2025-02-14 01:53:34
d = {'count': 9,
 'data': [{'amount': '0.1',
           'customer_order_id': '109317257',
           'date': 1654517494009,
           'direction': 'BUY',
           'id': 109317257,
           'portfolio_id': 1,
           'price': '0.1',
           'remaining_amount': '0.1',
           'status': 'CANCELLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [],
           'trading_pair_id': 1,
           'type': 'LIMIT'},
          {'amount': '1',
           'customer_order_id': '107613290',
           'date': 1655130347003,
           'direction': 'BUY',
           'id': 107613290,
           'portfolio_id': 1,
           'price': '0.1200',
           'remaining_amount': '0',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 336335,
                       'price': '0.12',
                       'time': 1655130347003,
                       'value': '1'}],
           'trading_pair_id': 48,
           'type': 'LIMIT'},
          {'amount': '40',
           'customer_order_id': '103699645',
           'date': 1651665830607,
           'direction': 'BUY',
           'id': 103699645,
           'portfolio_id': 1,
           'price': '0.1414',
           'remaining_amount': '0',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 179691,
                       'price': '0.141',
                       'time': 1651665830607,
                       'value': '40'}],
           'trading_pair_id': 48,
           'type': 'MARKET'},
          {'amount': '5000',
           'customer_order_id': '103655679',
           'date': 1651585314315,
           'direction': 'BUY',
           'id': 103655679,
           'portfolio_id': 1,
           'price': '0.1302',
           'remaining_amount': '0',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 174070,
                       'price': '0.1289',
                       'time': 1651585314315,
                       'value': '5000'}],
           'trading_pair_id': 48,
           'type': 'MARKET'},
          {'amount': '1',
           'customer_order_id': '103655666',
           'date': 1651585258788,
           'direction': 'BUY',
           'id': 103655666,
           'portfolio_id': 1,
           'price': '0.1302',
           'remaining_amount': '0',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 174068,
                       'price': '0.1289',
                       'time': 1651585258788,
                       'value': '1'}],
           'trading_pair_id': 48,
           'type': 'MARKET'},
          {'amount': '0.003',
           'customer_order_id': '103232017',
           'date': 1651007532982,
           'direction': 'SELL',
           'id': 103232017,
           'portfolio_id': 1,
           'price': '549780.00',
           'remaining_amount': '0.000',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 137448,
                       'price': '561000',
                       'time': 1651007532982,
                       'value': '0.003'}],
           'trading_pair_id': 50,
           'type': 'MARKET'}],
 'limit': 10,
 'offset': 0}

for i in d['data']:
    if(i['direction']=='BUY' and i['trading_pair_id'] == 48 and i['status'] == 'FILLED'):
        print(i['price'])
d = {'count': 9,
 'data': [{'amount': '0.1',
           'customer_order_id': '109317257',
           'date': 1654517494009,
           'direction': 'BUY',
           'id': 109317257,
           'portfolio_id': 1,
           'price': '0.1',
           'remaining_amount': '0.1',
           'status': 'CANCELLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [],
           'trading_pair_id': 1,
           'type': 'LIMIT'},
          {'amount': '1',
           'customer_order_id': '107613290',
           'date': 1655130347003,
           'direction': 'BUY',
           'id': 107613290,
           'portfolio_id': 1,
           'price': '0.1200',
           'remaining_amount': '0',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 336335,
                       'price': '0.12',
                       'time': 1655130347003,
                       'value': '1'}],
           'trading_pair_id': 48,
           'type': 'LIMIT'},
          {'amount': '40',
           'customer_order_id': '103699645',
           'date': 1651665830607,
           'direction': 'BUY',
           'id': 103699645,
           'portfolio_id': 1,
           'price': '0.1414',
           'remaining_amount': '0',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 179691,
                       'price': '0.141',
                       'time': 1651665830607,
                       'value': '40'}],
           'trading_pair_id': 48,
           'type': 'MARKET'},
          {'amount': '5000',
           'customer_order_id': '103655679',
           'date': 1651585314315,
           'direction': 'BUY',
           'id': 103655679,
           'portfolio_id': 1,
           'price': '0.1302',
           'remaining_amount': '0',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 174070,
                       'price': '0.1289',
                       'time': 1651585314315,
                       'value': '5000'}],
           'trading_pair_id': 48,
           'type': 'MARKET'},
          {'amount': '1',
           'customer_order_id': '103655666',
           'date': 1651585258788,
           'direction': 'BUY',
           'id': 103655666,
           'portfolio_id': 1,
           'price': '0.1302',
           'remaining_amount': '0',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 174068,
                       'price': '0.1289',
                       'time': 1651585258788,
                       'value': '1'}],
           'trading_pair_id': 48,
           'type': 'MARKET'},
          {'amount': '0.003',
           'customer_order_id': '103232017',
           'date': 1651007532982,
           'direction': 'SELL',
           'id': 103232017,
           'portfolio_id': 1,
           'price': '549780.00',
           'remaining_amount': '0.000',
           'status': 'FILLED',
           'stop_price': None,
           'time_in_force': 'GTC',
           'trades': [{'id': 137448,
                       'price': '561000',
                       'time': 1651007532982,
                       'value': '0.003'}],
           'trading_pair_id': 50,
           'type': 'MARKET'}],
 'limit': 10,
 'offset': 0}

for i in d['data']:
    if(i['direction']=='BUY' and i['trading_pair_id'] == 48 and i['status'] == 'FILLED'):
        print(i['price'])

如何从字典中的3个键中收集值?

波浪屿的海角声 2025-02-13 14:04:52

尝试此代码

import datetime

n = int(input())
a = list(map(int, input().split()))
start_time = datetime.now()
i = 1
k = 1
actions = 0
while i < n:
    if a[i] < a[i - 1]:
        actions = -1
        break
    elif a[i] == a[i - 1]:
        i += 1
        k += 1
    elif a[i] > a[i - 1]:
        for j in range(k):
            a[j] += 1
            j += 1
        actions += 1
print(actions)
print(datetime.now() - start_time)  # time consumed on run

try this code

import datetime

n = int(input())
a = list(map(int, input().split()))
start_time = datetime.now()
i = 1
k = 1
actions = 0
while i < n:
    if a[i] < a[i - 1]:
        actions = -1
        break
    elif a[i] == a[i - 1]:
        i += 1
        k += 1
    elif a[i] > a[i - 1]:
        for j in range(k):
            a[j] += 1
            j += 1
        actions += 1
print(actions)
print(datetime.now() - start_time)  # time consumed on run

计算包括控制台输入的程序执行时间,在Python 3中

波浪屿的海角声 2025-02-13 08:33:06

问题是另一个Component 未在 testbed 中声明。这就是编译器抱怨的内容。

测试中使用的所有组件都需要在测试台中声明(或通过该模块导入)

添加 entercomponent 添加到测试床声明中,您应该没问题:

TestBed.configureTestingModule({
                declarations: [HelloWorldComponent, AnotherComponent],
...

您可能必须添加另一个Component的依赖关系您的声明/提供商/进口。

The issue is that AnotherComponent is not declared in the TestBed. That's what the compiler is complaining about.

All components used in a test need to be declared in the TestBed (or imported via a module declaring it)

Add AnotherComponent to the TestBed declarations and you should be fine:

TestBed.configureTestingModule({
                declarations: [HelloWorldComponent, AnotherComponent],
...

You might have to add dependencies of the AnotherComponent to your declarations/providers/imports.

失败:单位测试中的错误

波浪屿的海角声 2025-02-12 09:14:59

如果有人仍在寻找我上述问题的答案。以下是对我有用的代码。

import openpyxl
import os
from openpyxl import load_workbook
import glob
from pathlib import Path

Excel_file_path="/Excel"

for file in Path(Excel_file_path).glob('*_Updated.xlsx'):
    wb=load_workbook(file)
    wb_modified = False
    for sheet in wb.worksheets:
        max_row_in_sheet = sheet.max_row
        max_col_in_sheet = sheet.max_column
        
        sheet_modified = False
        if max_row_in_sheet > 1:
            first_nonempty_row = get_first_nonempty_row() # Function to find nonempty row
            sheet_modified = del_rows_before(first_nonempty_row) #Function to delete nonempty roW
            file_name = os.path.basename(file)
    wb.save("Excel/"+file_name[:-5]+"_Transformed.xlsx")
wb.close()
      

In case, if any one is still looking for answer to my above question. Below is the code that worked for me.

import openpyxl
import os
from openpyxl import load_workbook
import glob
from pathlib import Path

Excel_file_path="/Excel"

for file in Path(Excel_file_path).glob('*_Updated.xlsx'):
    wb=load_workbook(file)
    wb_modified = False
    for sheet in wb.worksheets:
        max_row_in_sheet = sheet.max_row
        max_col_in_sheet = sheet.max_column
        
        sheet_modified = False
        if max_row_in_sheet > 1:
            first_nonempty_row = get_first_nonempty_row() # Function to find nonempty row
            sheet_modified = del_rows_before(first_nonempty_row) #Function to delete nonempty roW
            file_name = os.path.basename(file)
    wb.save("Excel/"+file_name[:-5]+"_Transformed.xlsx")
wb.close()
      

如何使用OpenPyXl Python将转换的文件保存到新的Excel文件中?

波浪屿的海角声 2025-02-12 03:47:18

两个播放器逻辑(如实现)

  • 标记
  • 在所有字段上单击迭代时第一个活动播放器,直到确定单击字段,
  • 如果它是播放器a的回合 play play a turn else player b turn

n 播放器逻辑(根据您的布尔数组的想法)

  • 标记布尔值数组中的第一个活动播放器,
  • 请在所有字段上单击迭代,直到在所有播放器上识别出单击字段
  • ,直到Active Player k ,然后do player k turn 和标记下一个活动播放器 j =(k+1)播放器的模数
buttons[i].addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        for(int i=0;i<size;i++) {
            if(e.getSource()==buttons[i]) {
                // iterate over players to find next active player
                for (int k = 0; k < 3; k++ ) { // 3 players
                        if (players[k]) {
                            // next active player found
                            if(buttons[i].getText()=="") {
                                buttons[i].setForeground(new Color(0,0,255));
                                buttons[i].setText(pIcon[k]);
                                players[k]=false;
                                int j = (k + 1) % 3; // index for next active player
                                players[j] = true; // mark next active player
                                txt.setText(pIcon[j] + " turn");
                                checkCondition();
                                break; // leave inner loop
                            }
                        }
                    }
                }
            }           
        }
    }
});

Two player logic (as implemented)

  • mark first active player
  • on click iterate over all fields until clicked field is identified
  • if it is player A's turn do player A turn else do player B turn

n player logic (according to your boolean array idea)

  • mark first active player in boolean array
  • on click iterate over all fields until clicked field is identified
  • iterate over all players until active player k is found then do player k turn and mark next active player j = (k+1) modulo number of players
buttons[i].addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        for(int i=0;i<size;i++) {
            if(e.getSource()==buttons[i]) {
                // iterate over players to find next active player
                for (int k = 0; k < 3; k++ ) { // 3 players
                        if (players[k]) {
                            // next active player found
                            if(buttons[i].getText()=="") {
                                buttons[i].setForeground(new Color(0,0,255));
                                buttons[i].setText(pIcon[k]);
                                players[k]=false;
                                int j = (k + 1) % 3; // index for next active player
                                players[j] = true; // mark next active player
                                txt.setText(pIcon[j] + " turn");
                                checkCondition();
                                break; // leave inner loop
                            }
                        }
                    }
                }
            }           
        }
    }
});

如何实现一系列玩家转弯?即Java的3-10名球员

波浪屿的海角声 2025-02-11 09:17:45

使用SetState更新列表,还可以从构建方法中删除列表声明

  class _MyHomePageState extends State<MyHomePage> {

  List<int> list = [1, 2, 3, 4, 5];

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          bottom: const TabBar(
            tabs: [
              Tab(icon: Icon(Icons.recycling_outlined)),
              Tab(icon: Icon(Icons.directions_transit)),
              Tab(icon: Icon(Icons.directions_bike)),
            ],
          ),
        ),
        body: TabBarView(
          children: [
            ListView.builder(
              padding: const EdgeInsets.all(4.0),
              itemCount: list.length,
              itemBuilder: (context, index) {
                var item = list[index];
                return Dismissible(
                  key: Key(item.toString()),
                  onDismissed: (direction) {
                    setState(() {
                      list.removeAt(index);
                    });
                  },
                  child: ListTile(
                    title: Text(item.toString()),
                  ),
                );
              },
            ),
            const Icon(Icons.directions_transit),
            const Icon(Icons.directions_bike),
          ],
        ),
      ),
    );
  }
}

Use setState to update list and also remove List declaration from build method

  class _MyHomePageState extends State<MyHomePage> {

  List<int> list = [1, 2, 3, 4, 5];

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          bottom: const TabBar(
            tabs: [
              Tab(icon: Icon(Icons.recycling_outlined)),
              Tab(icon: Icon(Icons.directions_transit)),
              Tab(icon: Icon(Icons.directions_bike)),
            ],
          ),
        ),
        body: TabBarView(
          children: [
            ListView.builder(
              padding: const EdgeInsets.all(4.0),
              itemCount: list.length,
              itemBuilder: (context, index) {
                var item = list[index];
                return Dismissible(
                  key: Key(item.toString()),
                  onDismissed: (direction) {
                    setState(() {
                      list.removeAt(index);
                    });
                  },
                  child: ListTile(
                    title: Text(item.toString()),
                  ),
                );
              },
            ),
            const Icon(Icons.directions_transit),
            const Icon(Icons.directions_bike),
          ],
        ),
      ),
    );
  }
}

TabView中的Flutter ListView Builder范围错误

波浪屿的海角声 2025-02-11 04:57:50

在for循环中,您每次运行 mood_list = list()每次运行时都会重新定义列表。相反,您需要做这样的事情:

mood = input('What anime do you want:')
mood_list = []
#print random anime
for item in anime:
  if item[1] == mood:
    k = item[0]
    print(mood + ' anime = ' + item [0])
    mood_list.append(k)

In your for loop, you are re-defining the list each time that you run mood_list=list(). Instead, you'll want to do something like this:

mood = input('What anime do you want:')
mood_list = []
#print random anime
for item in anime:
  if item[1] == mood:
    k = item[0]
    print(mood + ' anime = ' + item [0])
    mood_list.append(k)

由于某种原因,我无法在列表中保存多个不止一件事(而它是在循环中)

波浪屿的海角声 2025-02-10 20:47:26

而不是将您的凭据(直接或通过环境变量)编码 suppiect.txt 文件,而是应该配置凭证助手用于git。

将裸露的URL留在您的 unignts.txt 文件:

git+https://github.com/johnf1004/my_package.git

配置适当的凭据助手,例如 GH CLI 。在最近的版本中,您可以运行 gh auth setup-git 来创建必要的配置。

运行 GH auth Login 以对GitHub进行身份验证:

$ gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations? SSH
? Upload your SSH public key to your GitHub account? Skip
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: ABCD-1234
Press Enter to open github.com in your browser...
Opening in existing browser session.
✓ Authentication complete.
- gh config set -h github.com git_protocol ssh
✓ Configured git protocol
✓ Logged in as larsks

现在 git 将获得 https://github.com urls的凭据。 /代码>不需要您的任何互动。

Rather than encoding your credentials (either directly or via an environment variable) into your requirements.txt file, you should configure a credentials helper for git.

Leave the bare URL in your requirements.txt file:

git+https://github.com/johnf1004/my_package.git

Configure an appropriate credentials helper, such as the gh cli. In recent versions, you can run gh auth setup-git to create the necessary configuration.

Run gh auth login to authenticate to GitHub:

$ gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations? SSH
? Upload your SSH public key to your GitHub account? Skip
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: ABCD-1234
Press Enter to open github.com in your browser...
Opening in existing browser session.
✓ Authentication complete.
- gh config set -h github.com git_protocol ssh
✓ Configured git protocol
✓ Logged in as larsks

Now git will get credentials for https://github.com URLs from gh without requiring any interaction on your part.

pip install with sumperience.txt从私人回购提示密码

波浪屿的海角声 2025-02-10 18:02:01

您必须通过选择“承载者”来添加您拍摄的最后一步,否则会给您带来错误。我在最后一个步骤上很难做,然后执行以下链接,这应该有所帮助。

https://web.postman.co/workspace/My-Workspace~a4ddb3b8-02a3-4132-8384-66e63e149b7b/request/22958165-506a0542-c845-41ac-b3fb-b8209fd6f53b

The last step you have to add your taken by selecting "Bearer" or else it will give you error. I had hard time on the last ones, do all the steps and then go to the following link and it should help.

https://web.postman.co/workspace/My-Workspace~a4ddb3b8-02a3-4132-8384-66e63e149b7b/request/22958165-506a0542-c845-41ac-b3fb-b8209fd6f53b

WhatsApp Cloud API更新个人资料图片

波浪屿的海角声 2025-02-10 17:57:19

您在寻找这个吗?

success = [
    item for item in errors
    if item["name"] not in names and item["type"] == "direct_queried"
]

Are you looking for this?

success = [
    item for item in errors
    if item["name"] not in names and item["type"] == "direct_queried"
]

如何使用Python中的嵌套列表综合?

波浪屿的海角声 2025-02-10 12:47:58

我也遇到了这个问题。
截至编写此答案的那一刻,此处的SDK =&lt; v3.12.3由于与平台一起使用平台视图,如其版本中所述,log 在这里
解决方案是使用FVM并使用Flutter版本2.10.5运行该应用程序。

I ran into this issue as well.
As of the moment of writing this answer, the HERE SDK =< v3.12.3 is not compatible yet with Flutter 3.x due to this issue with platform views, as described in their release log here.
Solution is to use FVM and run the app using Flutter version 2.10.5.

颤音此处地图Android模拟器地图显示问题?

波浪屿的海角声 2025-02-10 06:13:11
const router = require("express").Router(),
const User=require("../database/models/User.model.js");

const cryptoJS = require("crypto-js");

//REGISTER
router.post("/register", async (req, res) => {
    const { username, email, password } = req.body;
    const checkUser = await User.findOne({ email: email })

    if (checkUser) {
        return res.status(400).json({
            message: "This email is alredy existing in our database" 
       });
    } else {
        const user = new User({
            username: username,
            email: email,
            password: cryptoJS.AES.encrypt(
                password,
                process.env.CRYPTO_KEY
            )
        });
        await user.save()
            .then(data=>res.json(data))
            .catch(err => res.status(500).json({ error: err.message }));
    }
});

module.exports = router;
const router = require("express").Router(),
const User=require("../database/models/User.model.js");

const cryptoJS = require("crypto-js");

//REGISTER
router.post("/register", async (req, res) => {
    const { username, email, password } = req.body;
    const checkUser = await User.findOne({ email: email })

    if (checkUser) {
        return res.status(400).json({
            message: "This email is alredy existing in our database" 
       });
    } else {
        const user = new User({
            username: username,
            email: email,
            password: cryptoJS.AES.encrypt(
                password,
                process.env.CRYPTO_KEY
            )
        });
        await user.save()
            .then(data=>res.json(data))
            .catch(err => res.status(500).json({ error: err.message }));
    }
});

module.exports = router;

如何检查MongoDB中的用户是否已经存在?

波浪屿的海角声 2025-02-09 23:59:37

答案在角度深处。
您正在使用 keyvaluepipe source

我们感兴趣的管道的一部分是:

    const differChanges: KeyValueChanges<K, V>|null = this.differ.diff(input as any);
    const compareFnChanged = compareFn !== this.compareFn;

    if (differChanges || compareFnChanged) {
      this.keyValues.sort(compareFn);
      this.compareFn = compareFn;
    }

如果差异会发现输入对象的差异,则将运行Sort函数。

您可以控制数字 and Code>,并在初始化视图后始终如一地返回 null 。为什么?我们需要查看

  // Add the record or a given key to the list of changes only when the value has actually changed
  private _maybeAddToChanges(record: KeyValueChangeRecord_<K, V>, newValue: any): void {
    if (!Object.is(newValue, record.currentValue)) {
      record.previousValue = record.currentValue;
      record.currentValue = newValue;
      this._addToChanges(record);
    }
  }

差异是使用 object.is(newValue,record.currentvalue)来确定值是否已更改。在这种情况下要分散的对象的值是对象本身, object.is()不会评估深度平等。

因此,您至少有两个选择:

  • 编写自己的钥匙值管,以您想要的方式工作。
  • 使用不同的数据结构保存您的电影信息

我已经创建了一个工作的stackblitz 使用自定义的Brute-Force诉讼策略 keyValue 管道。

The answer lies deep in the Angular core.
You are using the KeyValuePipe. Source here.

The part of the pipe we are interested in is this:

    const differChanges: KeyValueChanges<K, V>|null = this.differ.diff(input as any);
    const compareFnChanged = compareFn !== this.compareFn;

    if (differChanges || compareFnChanged) {
      this.keyValues.sort(compareFn);
      this.compareFn = compareFn;
    }

If the differ finds a difference in the input object, the sort function is run.

You can console log differChanges and see that it consistently returns null after the view is initialized. Why? We need to look at the differ code:

  // Add the record or a given key to the list of changes only when the value has actually changed
  private _maybeAddToChanges(record: KeyValueChangeRecord_<K, V>, newValue: any): void {
    if (!Object.is(newValue, record.currentValue)) {
      record.previousValue = record.currentValue;
      record.currentValue = newValue;
      this._addToChanges(record);
    }
  }

The differ is using Object.is(newValue, record.currentValue) to determine if the value has changed. The value of the object to be diffed in this case is an object itself, and Object.is() does not evaluate deep equality.

So you have at least two options:

  • Write your own keyvalue pipe that works the way you want it to.
  • Use a different data structure to hold your movie info

I've created a working StackBlitz with a custom brute-force resorting strategy keyvalue pipe.

使用Angular CDK DND使用地图时如何更新视图?

波浪屿的海角声 2025-02-09 23:44:42

试试看:

  for(int j = 0; j < height_of_gamefield; j++)
  {
    printf("%s%*s\n","|", width_of_gamefield,"|");
  }

%*s允许您为字符串填充指定变量号。

Try this instead:

  for(int j = 0; j < height_of_gamefield; j++)
  {
    printf("%s%*s\n","|", width_of_gamefield,"|");
  }

The %*s allows you to specify a variable number for the string padding.

如何在数组的最后一个元素上获取框架线

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文