小编e.d*_*vic的帖子

Git推动私人回购

我一直在网络应用程序上的本地工作,我被要求将其推送到一个空的(只读取我的文件)私人仓库为这个项目创建.我是新来的git,我很难这样做.

有人能告诉我我做错了什么吗?

我首先在本地使用命令行导航到应用程序的主文件夹并初始化git.之后,我尝试克隆远程仓库:

git clone git://github.com/somename/Web-App.git
Run Code Online (Sandbox Code Playgroud)

但我得到错误:

克隆到'Web-App'...致命:远程错误:未找到存储库.

我知道回购在那里..我是否真的需要先从那个遥控器克隆或拉出,或者是否有办法推送到那个回购.

同样,我所要做的就是将我本地文件中的文件推送到我可以访问的特定仓库.

我真的很感激任何帮助.

git push github

24
推荐指数
3
解决办法
5万
查看次数

无限循环java

问题规范:无限循环(菜单进入无限循环);

目标:请求用户输入整数,并按照代码中指定的逻辑继续.如何避免无限循环?

码:

    public Purchase groceryStoreMenu(LemonadeStand lemonadeStand){

    boolean getMenu = true;
    int userEnteredNumber = -1;
    currentPurchase = new Purchase();

    while(getMenu){
         try{

           System.out.println("Grocery Store");
           System.out.printf("%s\t%s%n%s\t%s%n%s\t%s%n%s\t%s%n%s\t%s%n%s\t%s%n" , "1:" , "Buy lemons", "2:", "Buy cups" , "3:" , "Buy sugar" , 
           "4:" , "Buy ice" , "5:" , "Done"); //change this 
           userEnteredNumber = reader.nextInt();

           if (userEnteredNumber == 1 ) {
              money = lemonadeStand.profit(0);
              lemonsMenu(money);
           }else if (userEnteredNumber == 2){
              money = lemonadeStand.profit(0);
              cupsMenu(money); 
           }else if (userEnteredNumber == 3){
              money = lemonadeStand.profit(0); …
Run Code Online (Sandbox Code Playgroud)

java loops infinite

0
推荐指数
1
解决办法
164
查看次数

为什么我需要在子类中重新声明`virtual`方法?[C++/Polymorphism]

有人可以解释一下,如果我们有一个带有virtual成员函数的抽象类,为什么我们需要在子类中再次声明它?例如,请参见下面的示例

抽象类

.h文件

#ifndef ALGORITHM_H
#define ALGORITHM_H

#include <vector>
#include "Event.h"

using std::vector;

class Algorithm{
protected:
  vector<Event>* dataset;
public:
  Algorithm(vector<Event>& dataset);
  virtual ~Algorithm();

  virtual void run() = 0;
};

#endif
Run Code Online (Sandbox Code Playgroud)

.cpp文件

#include "../include/Algorithm.h"

Algorithm::Algorithm(vector<Event>& dataset):dataset(&dataset){}
Algorithm::~Algorithm(){}
Run Code Online (Sandbox Code Playgroud)

鉴于run声明纯虚函数,通过扩展此类,我的期望是它只需要实现.但是,它仍然需要在类中声明扩展此抽象类.

子类

.h文件

#ifndef SELECT_ALGORITHM_RANDOM_H
#define SELECT_ALGORITHM_RANDOM_H

#include "Algorithm.h"

class SelectAlgorithmRandom : public Algorithm{
public:
  SelectAlgorithmRandom(vector<Event>& dataset);
  ~SelectAlgorithmRandom();

  void run(); // <-- why do I need this here, and doesn't it defy the purpose of me …
Run Code Online (Sandbox Code Playgroud)

c++ polymorphism

0
推荐指数
1
解决办法
70
查看次数

标签 统计

c++ ×1

git ×1

github ×1

infinite ×1

java ×1

loops ×1

polymorphism ×1

push ×1