我在NetBeans上用Java编写了一个代码:
package helloworld;
import java.sql.*;
import java.io.*;
import java.lang.Object;
import java.io.IOException;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.functors.EqualPredicate;
import org.apache.lucene.queryParser.ParseException;
public class HelloWorld {
public static void main(String[] args) throws IOException, ParseException {
// TODO code application logic here
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String url = "jdbc:mysql://localhost:3306/kdd";
String user = "root";
String password = "Pass1234"; …Run Code Online (Sandbox Code Playgroud) 我试图peek在Visual Studio 2010中使用这些库中的函数:
#include "stdafx.h"
#include <string>
#include <string.h>
#include <fstream>
#include <iostream>
#include <string.h>
#include <vector>
#include <stack>
Run Code Online (Sandbox Code Playgroud)
但是,我不能peek在堆栈中使用该函数:
void dfs(){
stack<Node> s;
s.push(nodeArr[root]);
nodeArr[root].setVisited();
nodeArr[root].print();
while(!s.empty()){
//peek yok?!
Node n=s.peek();
if(!n.below->isVisited()){
n.below->setVisited();
n.below->print();
s.push(*n.below);
}
else{
s.pop();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我收到错误:
错误1错误C2039:'peek':不是'std :: stack <_Ty>'的成员
我究竟做错了什么?
我应该使用哪种数据类型在MySQL数据库中存储像“10196385171799537224”(21位)这样的数字(ID)?