Linux中是否存在C++文档?我想要类似C的手册页.例如,字符串,stl,iostream,ifstream等的文档?
我有这样的伪代码:
if( b < a)
return (1,0)+foo(a-b,b)
Run Code Online (Sandbox Code Playgroud)
我想用python编写它.但python可以添加元组吗?编写类似代码的最佳方法是什么?
我正在使用Kdevelop来创建C++项目.现在我需要创建一个C项目.在3.xx版本中,我可以选择创建C项目,但现在我正在使用Kdevelop 4.2,我只能看到C++项目模板(QT/NOGui).
我该如何为C项目配置Kdevelop?
我想学习用opengl编程(实际上我想在将来学习图形,gpu和hpc),一位朋友建议我阅读GoF的书(设计模式),然后阅读有关Ogre3d或Qt或Sdl的内容.例子......我对此提出质疑,因为我在不久前读了一本书,我想提高自己的知识......设计模式是一个要求,然后学习opengl?
您对此代码有何看法?这是最好的方式吗?有什么改进?
Roman.h
#ifndef ROMAN_H
#define ROMAN_H
#include <string>
#include <map>
typedef unsigned long int UL_I;
typedef std::map< std::string, UL_I, std::less< std::string > > Map;
class Roman_Number
{
public:
//Constructor
Roman_Number( std::string );
void Convert_to_decimal();
UL_I get_Decimal() const;
std::string get_Roman() const;
private:
std::string s_roman_number;
UL_I d_number;
Map pairs;
Map pairs_substracting;
//Utilitaries functions
void _validate_();
void _initilize_pairs_()
{
pairs.insert( Map::value_type( "I", 1 ) );
pairs_substracting.insert( Map::value_type ( "IV", 4 ) );
pairs.insert( Map::value_type( "V", 5 ) );
pairs_substracting.insert( Map::value_type( "IX", 9 ) …Run Code Online (Sandbox Code Playgroud) 我正在阅读有关此算法的信息......我编写了一个压缩类,我还没有编写解压缩类......
你怎么看代码?
我想我有一个问题......我的编码是:“位置|长度”,但我相信这种方法会让我在减压时遇到问题,因为我不知道位置和长度的数量是2还是3 , 4 位数字... :S
一些建议将被接受... :D
任何建议都会被接受。
主文件:
#include <iostream>
#include "Compressor.h"
int main() {
Compressor c( "/home/facu/text.txt", 3);
std::cout << c.get_TEXT_FILE() << std::endl;
std::cout << c.get_TEXT_ENCONDED() << std::endl;
c.save_file_encoded();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
头文件:
#ifndef _Compressor_H_
#define _Compressor_H_
#include <utility>
#include <string>
typedef unsigned int T_UI;
class Compressor
{
public:
//Constructor
Compressor( const std::string &PATH, const T_UI minbytes = 3 );
/** GET BUFFERS **/
std::string get_TEXT_FILE() const;
std::string get_TEXT_ENCONDED() const;
/** END GET BUFFERS **/
void …Run Code Online (Sandbox Code Playgroud) 我开始阅读"C中的数字配方"一书......我尝试使我的程序更有效,更快......所以,使用C或C++是一回事吗?我知道C++是C的超集......但是,"cmath"库(c ++)与"math.h"库(c)之间是否存在差异?它会干预执行的速度吗?...为了那个...我可以使用C++而不与C程序有任何区别?
可能重复:
浮点不准确示例
我遇到了问题...当我编译src时,显示的变量与我初始化的变量不同,请参阅:
#include <iostream>
using namespace std;
int main()
{
long double mynum = 4.7;
cout.setf(ios::fixed,ios::floatfield);
cout.precision( 20 );
cout << mynum << endl;
}
Run Code Online (Sandbox Code Playgroud)
然后:
[fpointbin@fedora ~]$ ./a.out
4.70000000000000017764
Run Code Online (Sandbox Code Playgroud)
怎么解决?我想"cout"节目4.700000 ......