User Profile
Collapse
-
try using functions generated by lex ..search google for lex -
-
That is true.
if you do not want to use loops, use memcopy to copy memory in one goLeave a comment:
-
...Code:/home/jaivrat/cpp/test>cat -n test.cpp 1 #include <iostream> 2 #include <string> 3 4 int main(){ 5 6 std::string str; 7 8 std::cout<<"Please eter string:"; 9 std::cin>>str; 10 for (int i=0; i< str.length(); ++i){ 11 std::string temp("");Leave a comment:
-
Try including
By mistake i missed it. Pls revert back if it works now..Code:#include<string>
I was using g++ on cygwin it did not give me errors.....Leave a comment:
-
looks like a school assigment which nobody wil want to do..but just FYH
...Code:1 #include<iostream> 2 #include<fstream> 3 #include<map> 4 #include<ctype.h> 5 6 typedef std::map<std::string, int> StrMap; 7 void recordData( StrMap& m, std::string& str); 8 9 int main(int argc, char* argv[]){Leave a comment:
-
Because you are delaring it as a reference... all references mut me intialised in the intialisation list of the Ctor rather than the body for Ctor.. Reason is obvious.. reference point to a definite memory as soon as they come into existence..
I hope you understand diff between intializer list and assignment inside Ctor body.. if not, then reply back ..or you may find it in any std text.Leave a comment:
-
Full code:
...Code:1 #include<iostream> 2 #include<cstdio> 3 #include <sys/types.h> 4 #include <dirent.h> 5 #include <cstdlib> 6 #include <cerrno> 7 8 int printFiles(char * dirname); 9 int countFiles(char * dirname); 10 int main( int argc, char *argv[]){ 11 12 printf("argv[1]Leave a comment:
-
a small sample.. use it to count or to print :)
...Code:int printFiles(char * dirname){ DIR* dirp; dirp = opendir(dirname); struct dirent * dp=0; int i=0; while (dirp) { i++; std::cout<<" In while loop "<<i<<std::endl; errno = 0; if ((dp = readdir(dirp)) != NULL) { std::string curr(dp->d_name);Leave a comment:
-
I think this quest should not belong to a C/C++ tech forum. Anyways this is not an answer to your questionLeave a comment:
-
What do you exaclty want to know. Can you post the hypthetical output you expect.
You code will print the pointer(address es) of adjacent structures. thus if we say (suppose) the junk address contained by defn:
is 4022 and size of int(or unsigned int) on your machine is 4, then delta=(3+3*3*2) *4 = 84, your program will printCode:struct Calib *st_ptr;
4022
4106
4190
......
...Leave a comment:
-
-
struct Point {
float x;
float y;
struct Point* next;
};
Generally nodes of linked lists are examples of self referential structures - which refer to memory location of same type by storing a self type poiter as a member.Leave a comment:
-
Can you pls rephrase your question so that we can know what you want to ask ?Leave a comment:
-
It should not fail, You are doing a major mistake.. How can you take a char pointer argument from stdin ????? Do you know address where chars are stored..
here it works
[HTML][jsingh]:/home/jsingh/cpp/templates/test% ./a.out
Enter 5 elements
1 2 3 4 5
1 2 3 4 5
aa bb cc dd eee fff ggg
aa bb cc dd eee a t g e f [jsingh@sgs45a-0145]:/home/jsingh/cpp/templates/test%...Leave a comment:
-
I am not sure if you are saying the it soes not gets substr method of std::string class , but effect you are trying to achive can be done by
...Code:int DoSome(string *inp) { if ((*inp).substr(0,6)=="myflow") { // here's my problem, inp only points, and don't got the method substr. (*inp) = (*inp).substr(6); // lot of code here } return (0); } int DoSome(string &inp)Leave a comment:
-
Standard C does not provide any intergral functions like Integral of x*x from limits 2 to x=4 and give you answer like ( 1/3) ( 4*4 - 2*2)
You can find MATLAB and othe available libraries for this.
Moreover you can write your own by using infinitesimal summation methods..
Cygwin alo provides similar utilities.Leave a comment:
-
I wrote this badly but funda remains same the--> % operator to go to correct place in array. I have not tested it properly.. but some work reqd by you :)
[HTML] 1 #include<stdio. h>
2 #include<assert .h>
3
4 #define SIZE 10
5
6
7 struct Queue {
8 char arr[SIZE] ;
9 int front;
10 int back ;...Leave a comment:
No activity results to display
Show More
Leave a comment: