I am using Visual C++ 2005 to write code a win32 console application.
There was an error message about the power function when I compiled the code. It is: error c2668: 'pow' :ambiguous call to overloaded function.
The statement is:
tempDistance += pow((data[selectedInstance][k]-data[j][k...
I used various headers like:
%26lt;cmath%26gt;, %26lt;math.h%26gt; %26lt;valarray%26gt; and %26lt;complex%26gt; but the error message remained the same.
What is the cause of the error? I've checked the syntax and it seems correct.
Pow() error in Visual C++ 2005?
double pow(double x,double y) (from math.h); there you also have powf (for float) and powl ofr long double); Check how you declared tempDistance and the array! The compiler doesn't know what conversion to apply in your case...
Reply:What?
Reply:Double check the data type of your argument to the pow() function. There is likely more than one overload of pow() that will do what you want, but the compiler can't decide which one to use. Just stick and explicit cast in there and be done with it. To wit:
pow( double(data[selectedInstance]........
Note the insertion of a double() constructor!
Or use old-fashioned C-style cast:
(double)(arg)
Reply:Here is what I'm finding as the problem, pow(int, int) has been removed from math.h.
1. Look at the data type of your arguments.
2. Look at the data type of your variable. (tempDistance)
The compiler is trying to figure it what to use when it just can't.
if you haven't written overloaded functions yet the error might not make much sense to you.
(Remember that pow(int,int) is gone. )
flash cards
Tuesday, July 14, 2009
Switch/case statement in C help please?
The problem is make a program that will display a corresponding letter grade to the ff. input values: A for 90 above, B for 80-89, C for 70-79, D for 60-69, and F for below 60 using switch/case statements.
The limits for A are 90%26lt;=A%26lt;=100; for 50%26lt;=F%26lt;=59. The default statement is "out of range". How do you input the syntax for the cases, complete with the %26lt;= and %26gt;= conditions? Just one example of a case (to follow and continue) will be great, thanks.
Switch/case statement in C help please?
in cases, we can't use %26lt;= or %26gt;=
one way to solve ur problem wud be:
void main()
{
int num,A,B,C,D,F;
printf("Enter a number: ");
scanf("%d",%26amp;num);
switch(A)
{
case 90:
case 91:
/*
..
.. u can fill the values in between..
*/
case 100: printf("grade is A"); break;
case 80:
case 81:
/*
..
.. fill the in between values
*/
case 89: printf("grade is B"); break;
/* similarly for other grades.. just remember to put break; statement on the last value of a given range for a grade */
default: printf("The number is out of range");
}
Reply:You need to use if/else statement. Switch won't allow that type of checking.
The limits for A are 90%26lt;=A%26lt;=100; for 50%26lt;=F%26lt;=59. The default statement is "out of range". How do you input the syntax for the cases, complete with the %26lt;= and %26gt;= conditions? Just one example of a case (to follow and continue) will be great, thanks.
Switch/case statement in C help please?
in cases, we can't use %26lt;= or %26gt;=
one way to solve ur problem wud be:
void main()
{
int num,A,B,C,D,F;
printf("Enter a number: ");
scanf("%d",%26amp;num);
switch(A)
{
case 90:
case 91:
/*
..
.. u can fill the values in between..
*/
case 100: printf("grade is A"); break;
case 80:
case 81:
/*
..
.. fill the in between values
*/
case 89: printf("grade is B"); break;
/* similarly for other grades.. just remember to put break; statement on the last value of a given range for a grade */
default: printf("The number is out of range");
}
Reply:You need to use if/else statement. Switch won't allow that type of checking.
Switch/case problem in C language. Help please?
Problem: Write a program that accepts an ordinary number and output its equivalent Roman numeral. The ordinary numbers and their equivalent Roman numerals are as follows: 1 corresponds to I ; 5 = V; 10 = X; 50 = L; 100 = C; 500 = D; 1000 = M.
Sample input/output on screen: Enter a number: 2968
The Roman numeral is: MMCMLXVIII
Note that maximum input number is 3,000.
I don't know how to do it, it can't possibly mean doing the syntax 3000 times! I think it may have to do with the place values, but I don't know how to work it out. Help please? Thanks.
Switch/case problem in C language. Help please?
To convert an integer into Roman numerals, you'll need to have a "while loop" to repeatedly generate the numerals you want until the result reaches zero.
Inside the loop, you'll have a switch statement that goes something like:
Switch input:
case input %26gt; 1000
output "M"
input = input - 1000
break
case input %26gt; 900
output "XM"
input = input - 900
break
...
...
End Switch
Reply:From old memories.. look at the dragon book for compilers. I vaguely recall it having this case as an example for illustrating scanning or parsing.
read from left to right. for every letter that represents a value greater than the most recent one that you have read in, subtract the smaller one from the bigger one. At the same time, if you come across an X, add 10 to some variable. If you read IX, add 1 to a variable and remember 1 in a temp variable. if the temp is lesser than the next one, say in this case, X(=10), then subtract the temp from the grand total, and add present-temp to the grand total. This way, you should be able to work out.
Anyway, this came to me off handed and might need some fine tuning.
Reply:Pseudo-code sample could be something like:
char input[];
char output[];
int number;
for(i=0;i%26lt;sizeof(input)/sizeof(char);i...
number = atoi(input[i]);
switch(number)
case 1:
if(number%1000) output[i]="M";
else(number%100) output[i]="C";
else(number%10) output[i]="X";
else output[i]="I";
break;
}
But you'll need to extend this and write it out properly, cos I couldn't be bothered ;-)
Reply:No need for a switch statement at all. The Cleanest that I can think of would be this:
void PrintRoman (int Number)
{
char Roman[100];
int Position = 0;
while (Number %26gt;= 1000)
{
Roman[Position++] = 'M';
Number -= 1000;
}
if (Number %26gt;= 900)
{
Roman[Position++] = 'C';
Roman[Position++] = 'M';
Number -= 900;
}
if (Number %26gt;= 500)
{
Roman[Position++] = 'D';
Number -= 500;
}
while (Number %26gt;= 100)
{
Roman[Position++] = 'C';
Number -= 100;
}
if (Number %26gt;= 90)
{
Roman[Position++] = 'X';
Roman[Position++] = 'C';
Number -= 90;
}
if (Number %26gt;= 50)
{
Roman[Position++] = 'L';
Number -= 50;
}
while (Number %26gt;= 10)
{
Roman[Position++] = 'X';
Number -= 10;
}
if (Number %26gt;= 9)
{
Roman[Position++] = 'I';
Roman[Position++] = 'X';
Number -= 9;
}
if (Number %26gt;= 5)
{
Roman[Position++] = 'V';
Number -= 5;
}
if (Number %26gt;= 4)
{
Roman[Position++] = 'I';
Roman[Position++] = 'V';
Number -= 4;
}
while (Number %26gt;= 1)
{
Roman[Position++] = 'I';
Number -= 1;
}
Roman[Position] = '\0';
printf ("Roman is %s\n", Roman)
}
There are more compact ways to write this using either parallel arrays or a structure, but for clarity, the above is best.
flower girl
Sample input/output on screen: Enter a number: 2968
The Roman numeral is: MMCMLXVIII
Note that maximum input number is 3,000.
I don't know how to do it, it can't possibly mean doing the syntax 3000 times! I think it may have to do with the place values, but I don't know how to work it out. Help please? Thanks.
Switch/case problem in C language. Help please?
To convert an integer into Roman numerals, you'll need to have a "while loop" to repeatedly generate the numerals you want until the result reaches zero.
Inside the loop, you'll have a switch statement that goes something like:
Switch input:
case input %26gt; 1000
output "M"
input = input - 1000
break
case input %26gt; 900
output "XM"
input = input - 900
break
...
...
End Switch
Reply:From old memories.. look at the dragon book for compilers. I vaguely recall it having this case as an example for illustrating scanning or parsing.
read from left to right. for every letter that represents a value greater than the most recent one that you have read in, subtract the smaller one from the bigger one. At the same time, if you come across an X, add 10 to some variable. If you read IX, add 1 to a variable and remember 1 in a temp variable. if the temp is lesser than the next one, say in this case, X(=10), then subtract the temp from the grand total, and add present-temp to the grand total. This way, you should be able to work out.
Anyway, this came to me off handed and might need some fine tuning.
Reply:Pseudo-code sample could be something like:
char input[];
char output[];
int number;
for(i=0;i%26lt;sizeof(input)/sizeof(char);i...
number = atoi(input[i]);
switch(number)
case 1:
if(number%1000) output[i]="M";
else(number%100) output[i]="C";
else(number%10) output[i]="X";
else output[i]="I";
break;
}
But you'll need to extend this and write it out properly, cos I couldn't be bothered ;-)
Reply:No need for a switch statement at all. The Cleanest that I can think of would be this:
void PrintRoman (int Number)
{
char Roman[100];
int Position = 0;
while (Number %26gt;= 1000)
{
Roman[Position++] = 'M';
Number -= 1000;
}
if (Number %26gt;= 900)
{
Roman[Position++] = 'C';
Roman[Position++] = 'M';
Number -= 900;
}
if (Number %26gt;= 500)
{
Roman[Position++] = 'D';
Number -= 500;
}
while (Number %26gt;= 100)
{
Roman[Position++] = 'C';
Number -= 100;
}
if (Number %26gt;= 90)
{
Roman[Position++] = 'X';
Roman[Position++] = 'C';
Number -= 90;
}
if (Number %26gt;= 50)
{
Roman[Position++] = 'L';
Number -= 50;
}
while (Number %26gt;= 10)
{
Roman[Position++] = 'X';
Number -= 10;
}
if (Number %26gt;= 9)
{
Roman[Position++] = 'I';
Roman[Position++] = 'X';
Number -= 9;
}
if (Number %26gt;= 5)
{
Roman[Position++] = 'V';
Number -= 5;
}
if (Number %26gt;= 4)
{
Roman[Position++] = 'I';
Roman[Position++] = 'V';
Number -= 4;
}
while (Number %26gt;= 1)
{
Roman[Position++] = 'I';
Number -= 1;
}
Roman[Position] = '\0';
printf ("Roman is %s\n", Roman)
}
There are more compact ways to write this using either parallel arrays or a structure, but for clarity, the above is best.
flower girl
Query format for date incorrect using C#?
This query results in a syntax error. The error message makes mention of a missing operator, but I think it is a format problem with the date. I've searched the internet and all of my books and there is very little information on how to properly format a date/time query in Visual C Sharp.
This is the query that contains an error.
NOTE: I HAD TO ADD SPACES IN ORDER TO VIEW THE CODE HERE.
"SELECT DateTime FROM Events WHERE " + monthCalendar1. SelectionStart. AddDays(4). ToString() + " %26lt; DateTime"
Ive tried using "BETWEEN "+ monthCalendar1. SelectionStart. AddDays(4). ToString() +" AND DateTime"
but had the same error
there must be a problem with the format of monthCalendar1. SelectionStart. AddDays(4). ToString()
I hope there are some knowledgeable C# programmers out there with experience working with databases!
Query format for date incorrect using C#?
1) You have not specified the field in the where clause
"SELECT DateTime FROM Events WHERE FIELDNAME BETWEEN " + monthCalendar1. what ever
2) When you are using date values and passing to Sql, you need to format it
example: SELECT * FROM example WHERE exampledate between '2007-01-01'
AND '2007-06-10'
This is the query that contains an error.
NOTE: I HAD TO ADD SPACES IN ORDER TO VIEW THE CODE HERE.
"SELECT DateTime FROM Events WHERE " + monthCalendar1. SelectionStart. AddDays(4). ToString() + " %26lt; DateTime"
Ive tried using "BETWEEN "+ monthCalendar1. SelectionStart. AddDays(4). ToString() +" AND DateTime"
but had the same error
there must be a problem with the format of monthCalendar1. SelectionStart. AddDays(4). ToString()
I hope there are some knowledgeable C# programmers out there with experience working with databases!
Query format for date incorrect using C#?
1) You have not specified the field in the where clause
"SELECT DateTime FROM Events WHERE FIELDNAME BETWEEN " + monthCalendar1. what ever
2) When you are using date values and passing to Sql, you need to format it
example: SELECT * FROM example WHERE exampledate between '2007-01-01'
AND '2007-06-10'
Lowercase to Uppercase C++ program?
Can someone create a C++ program for me that will convert lowercase letters to uppercase letters and will stop when the user inputs a non-lowercase character? I'd like it to be simple and only use iostream as the header file. Please, no if statements, just a while loops, cout, cin, endl, and proper syntax. Thnx!
Lowercase to Uppercase C++ program?
use toupper,tolower,isalpha functions
Reply:What for? C has built-in funtions do that.
Reply:I'll let you do your own homework, but I'll give you a hint. A character is really just an int. The mapping of characters to their numeric ASCII values is well defined. Capital A=65, B=66, all the way to Z=90. Lower case letters are a=97 to z=122. Converting a lowercase letter to its uppercase counterpart can be simply a matter of subtraction.
Here's a link to an ascii chart, but I'm sure your text book has one. http://www.asciitable.com/
Lowercase to Uppercase C++ program?
use toupper,tolower,isalpha functions
Reply:What for? C has built-in funtions do that.
Reply:I'll let you do your own homework, but I'll give you a hint. A character is really just an int. The mapping of characters to their numeric ASCII values is well defined. Capital A=65, B=66, all the way to Z=90. Lower case letters are a=97 to z=122. Converting a lowercase letter to its uppercase counterpart can be simply a matter of subtraction.
Here's a link to an ascii chart, but I'm sure your text book has one. http://www.asciitable.com/
AS/400 and C++ :::for video game developement which is best?
I am getting to go to school for developing video games. I have heard a great deal about C++, but not much about AS/400. I have read all about it AS/400 in Wikopedia. When I did a search for video game development employment, I read that many are asking for this language. Can someone tell me if I had to learn only one which one should I learn and why? If I could learn both, which one should I base my emphasis in? I did notice that they are different in structure and syntax so learning one will not benefit the other too much other than in concept of ideas.
Thanks
AS/400 and C++ :::for video game developement which is best?
While C is native on the AS/400, this is not a gaming system but rather a business batch job processing and DBMS system primarily used for medium to large scale data storage and manipulation like data warehousing and ERP applications.
It is good to learn how to logically think so you can apply logic to any programming language. Once you are able to break a large problem down into smaller pieces, you are well on your way to being a programmer. Remember, LOGIC will NEVER change, only the syntax will.......
If you are looking for game programming, the AS/400 is not where you should be looking.
Reply:The AS/400 is an IBM midrange computer (a small step down from a mainframe). It is not a complier. They are probably referring to C++ on an AS/400.
Thanks
AS/400 and C++ :::for video game developement which is best?
While C is native on the AS/400, this is not a gaming system but rather a business batch job processing and DBMS system primarily used for medium to large scale data storage and manipulation like data warehousing and ERP applications.
It is good to learn how to logically think so you can apply logic to any programming language. Once you are able to break a large problem down into smaller pieces, you are well on your way to being a programmer. Remember, LOGIC will NEVER change, only the syntax will.......
If you are looking for game programming, the AS/400 is not where you should be looking.
Reply:The AS/400 is an IBM midrange computer (a small step down from a mainframe). It is not a complier. They are probably referring to C++ on an AS/400.
Write a c program to store and edit the records?
for eg.if i give"create table tablename(name,varchar(10),salary,(10,2)... program should parse the given statement and check if the syntax is correct.if it is correct,then a structure should be created with the same tablename with name and salary in it.i am just a beginner so dont go deeply into sql or anything.i need a c program just to parse and check a given statement.only the statement is similar to that in sql.like this i have to do for select,insert,delete and update.
Write a c program to store and edit the records?
Best option would be to use LEX and YACC to parse the ddl statements. Then you could use a flat file (with your predefined formats for your name/salary fields) to populate the objects.
The scope for coding is beyond the means of this group. I guess you have a good starting point though.
curse of the golden flower
Write a c program to store and edit the records?
Best option would be to use LEX and YACC to parse the ddl statements. Then you could use a flat file (with your predefined formats for your name/salary fields) to populate the objects.
The scope for coding is beyond the means of this group. I guess you have a good starting point though.
curse of the golden flower
From C to Java?
in C ; when i have a variable called for example first; i can say 'first' and it returns to me the ASCII of the value of that variable, either it was character,integer,.....; How can i do this in Java (i want a method or a syntax that enables me to get the Unicode value of any Object)
From C to Java?
well you can type cast a variable
example
char myChar = 'A';
int myInt = (int)myChar;
it will return the ascii value of that char
or
string str = new string("blah");
str.getBytes() // returns a array of character encodeing
good luck
From C to Java?
well you can type cast a variable
example
char myChar = 'A';
int myInt = (int)myChar;
it will return the ascii value of that char
or
string str = new string("blah");
str.getBytes() // returns a array of character encodeing
good luck
Java/C# Programming book with example projects?
I'm looking for a C# or Java textbook that's unlike most books in that it has exercises and suggested projects, instead of just detailing the language's syntax and whatnot. If it has the solutions, that would be fantastic too. Similarly, I'm also looking for a book that will guide me towards creating a usable, complex application.
I've had no luck in my search. Thank you for reading.
Java/C# Programming book with example projects?
I like Professional C# from Wrox:
http://www.amazon.com/Professional-C-Pro...
It focuses on learning the language by building progressively more complex programs, and includes all of the code for each example and breakdown of what it does. Subsequent chapters also build on previous ones by adding new or more complex functionality to previous examples you've already done. Towards the end of the book, the examples begin to approach real-world practical functionality.
I have about 15 Wrox books in my library - they're great.
Reply:not a book, but here's a website with sample codes:
Planet Source Code
http://www.pscode.com
Reply:All the books mentioned before are great, but I recommend going to a local university bookstore where they sell textbooks. There you are going to find books that show you how to program and written with chapter reviews, exercises and test questions because they were designed for classes.
I always recommend Apress books, I find visual blueprint series great (doesn't have questions but the way they wrote the book is exampled everywhere on every page) and some wrox books are good and some are dry. My favorite series of all time though has to be the Sams teach yourself series. Great beginner books and I use them to break into a new language every time.
Good luck!
Reply:I always suggest the APRESS range of C# books. They have a great beginner to professional and then expert range of books. Not only do they cover C# core but also have great books on specific technologies like ASP.NET, Web Services, REST, Architecture design(CSLA), Windows Communication Foundation, Windows Workflow Foundation and Atlas/Ajax.
http://www.apress.com/category.html?nID=...
I've had no luck in my search. Thank you for reading.
Java/C# Programming book with example projects?
I like Professional C# from Wrox:
http://www.amazon.com/Professional-C-Pro...
It focuses on learning the language by building progressively more complex programs, and includes all of the code for each example and breakdown of what it does. Subsequent chapters also build on previous ones by adding new or more complex functionality to previous examples you've already done. Towards the end of the book, the examples begin to approach real-world practical functionality.
I have about 15 Wrox books in my library - they're great.
Reply:not a book, but here's a website with sample codes:
Planet Source Code
http://www.pscode.com
Reply:All the books mentioned before are great, but I recommend going to a local university bookstore where they sell textbooks. There you are going to find books that show you how to program and written with chapter reviews, exercises and test questions because they were designed for classes.
I always recommend Apress books, I find visual blueprint series great (doesn't have questions but the way they wrote the book is exampled everywhere on every page) and some wrox books are good and some are dry. My favorite series of all time though has to be the Sams teach yourself series. Great beginner books and I use them to break into a new language every time.
Good luck!
Reply:I always suggest the APRESS range of C# books. They have a great beginner to professional and then expert range of books. Not only do they cover C# core but also have great books on specific technologies like ASP.NET, Web Services, REST, Architecture design(CSLA), Windows Communication Foundation, Windows Workflow Foundation and Atlas/Ajax.
http://www.apress.com/category.html?nID=...
In C Programming, Whats the difference of Contrast Arrays and Structs?
In C Programming, i've been self studying... and i am now in arrays but confused with these 2 on the book Contrast Arrays and Structs Difference. They both handles information but whats the difference? And even in syntax, are they both different?
In C Programming, Whats the difference of Contrast Arrays and Structs?
example an array can only hold on data type. if you define an array of 10 integers then you can hold 10 integers only. The way it actually works is it allocates the memory for 10 integers and lays it out in memory in contiguous memory. Arrays have to be indexed to get/put data. in c you would define an array like int myArray[10] that would be an array of integers. To access the first item you could write myArray[0].
A struct can hold multiple data types in it. You can build the following struct
struct TEST{
double myDouble;
int myInt;
} typedef test;
this struct hold a double and an int. They are laid out in consecutive memory like an array, but you do not index it.
example
test myTest;
myTest.myDouble = 3.5;
myTest.myInt = 2;
you could have an array of structs, or even a struct with an array in it..
array of structs example:
test myTest[10]
myTest[0].myDouble = 3.5;
myTest[0].myInt = 2;
myTest[1].myDouble = 2.5;
index 0 in the array sets the integer to 2 and the double to 3.5.
index 1 sets the double to 2.5
struct with an array example
struct TEST2
{
int intArray[10];
double myDouble;
} typedef test2 ;
test2 myTest;
myTest.intArray[0] = 1;
myTest.intArray[1] = 2;
myTest.myDouble = 3.5;
Other operation can be performed to access the data in an array and a struct, illustrating how they are laid out in contiguous memory.
if you are familiar with poitners in c, you know to dereference a ptr you would use *. well The [ ] used in indexing an array are the same thing as *(myInt+(sizeof(int) * index))
so if you declared a pointer and instantiated it to hold 10 times the size of an int, you could index it as if it were an array and vice versa.
int *myArray;
myArray = new int[10];
myArray[5] = 0;
is the same as
*(myArray + (5 * sizeof(int)))
Reply:I've never heard of a Contrast Array.
An array is a collection of variables of a certain type, like 5 integers or 10 characters. You can access each element by index.
A struct is a collection of variables. When you declare an instance of a struct, it creates an instance of each of that struct's variables.
They are very different in syntax and purpose.
In C Programming, Whats the difference of Contrast Arrays and Structs?
example an array can only hold on data type. if you define an array of 10 integers then you can hold 10 integers only. The way it actually works is it allocates the memory for 10 integers and lays it out in memory in contiguous memory. Arrays have to be indexed to get/put data. in c you would define an array like int myArray[10] that would be an array of integers. To access the first item you could write myArray[0].
A struct can hold multiple data types in it. You can build the following struct
struct TEST{
double myDouble;
int myInt;
} typedef test;
this struct hold a double and an int. They are laid out in consecutive memory like an array, but you do not index it.
example
test myTest;
myTest.myDouble = 3.5;
myTest.myInt = 2;
you could have an array of structs, or even a struct with an array in it..
array of structs example:
test myTest[10]
myTest[0].myDouble = 3.5;
myTest[0].myInt = 2;
myTest[1].myDouble = 2.5;
index 0 in the array sets the integer to 2 and the double to 3.5.
index 1 sets the double to 2.5
struct with an array example
struct TEST2
{
int intArray[10];
double myDouble;
} typedef test2 ;
test2 myTest;
myTest.intArray[0] = 1;
myTest.intArray[1] = 2;
myTest.myDouble = 3.5;
Other operation can be performed to access the data in an array and a struct, illustrating how they are laid out in contiguous memory.
if you are familiar with poitners in c, you know to dereference a ptr you would use *. well The [ ] used in indexing an array are the same thing as *(myInt+(sizeof(int) * index))
so if you declared a pointer and instantiated it to hold 10 times the size of an int, you could index it as if it were an array and vice versa.
int *myArray;
myArray = new int[10];
myArray[5] = 0;
is the same as
*(myArray + (5 * sizeof(int)))
Reply:I've never heard of a Contrast Array.
An array is a collection of variables of a certain type, like 5 integers or 10 characters. You can access each element by index.
A struct is a collection of variables. When you declare an instance of a struct, it creates an instance of each of that struct's variables.
They are very different in syntax and purpose.
When C++ was created, what was the compiler made by Bjarne stroustrup?
I can't seem to understand why there are so many compilers out there that suck and each of them produces a different error and none of them is ANSI/ISO compatible fully, while the creator of the language himself should have made the right one! I mean, one of them even says it has a syntax error in one of its own libraries!
I'm going to try out eclipse cuz Dev C++ is driving me nuts but I need to get a good compiler! Borland doesn't even have a debugger so what can I do?
P.S: I only write console applications because I program for contests and training sites like USACO's training site.
Please answer the main question cuz it's the one that's killing me. Where's the original compiler?
When C++ was created, what was the compiler made by Bjarne stroustrup?
Even the "original" compiler had lots of bugs. C++ is a very complex language, making it extremely difficult to create a bug-free compiler. I feel your pain.
Good luck!
Reply:Have you tried Microsoft Visual Studio? It comes with a console compiler. You need to set it up, but it works...as long as you aren't on Vista.
Reply:Stroustrup did a book, not a compiler. Everyone has been free to implement their own subset of the C++ language, all along.
I'm on Linux, incidently, so I haven't had to pay for a Borland Compiler for a while: however the last time I actually bought one (around 2002) it came with an IDE -- Integrated Debugging Editor which certainly worked. Have you bought a Borland compiler or did you just download it?
Naturally when I hear someone is having trouble with Dev C++ or any implementation of GCC I'm sorry to hear it. If you are just programming for the console, have you considered DJGPP? With GDB and GProf GCC does have debugging capabilities. I've never used CDT but I do wish you luck.
Still, a reasonably complete implementation of the C++ programming language and (separately) the Standard Template Library is available at http://www.digitalmars.com. Their IDE, which I've never used, is available on their CD which costs $54. You can download and install a command line version for free. You also have to install the STL separately, which can be tricky (before I dumped DOS I used a batch file to compile my C++ programs) but once you get it working it is very awesome.
Reply:If yo want a good compiler, Go to www.bloodshed.net and download the free Dev C++,
Good Luck
Omar
apricot
I'm going to try out eclipse cuz Dev C++ is driving me nuts but I need to get a good compiler! Borland doesn't even have a debugger so what can I do?
P.S: I only write console applications because I program for contests and training sites like USACO's training site.
Please answer the main question cuz it's the one that's killing me. Where's the original compiler?
When C++ was created, what was the compiler made by Bjarne stroustrup?
Even the "original" compiler had lots of bugs. C++ is a very complex language, making it extremely difficult to create a bug-free compiler. I feel your pain.
Good luck!
Reply:Have you tried Microsoft Visual Studio? It comes with a console compiler. You need to set it up, but it works...as long as you aren't on Vista.
Reply:Stroustrup did a book, not a compiler. Everyone has been free to implement their own subset of the C++ language, all along.
I'm on Linux, incidently, so I haven't had to pay for a Borland Compiler for a while: however the last time I actually bought one (around 2002) it came with an IDE -- Integrated Debugging Editor which certainly worked. Have you bought a Borland compiler or did you just download it?
Naturally when I hear someone is having trouble with Dev C++ or any implementation of GCC I'm sorry to hear it. If you are just programming for the console, have you considered DJGPP? With GDB and GProf GCC does have debugging capabilities. I've never used CDT but I do wish you luck.
Still, a reasonably complete implementation of the C++ programming language and (separately) the Standard Template Library is available at http://www.digitalmars.com. Their IDE, which I've never used, is available on their CD which costs $54. You can download and install a command line version for free. You also have to install the STL separately, which can be tricky (before I dumped DOS I used a batch file to compile my C++ programs) but once you get it working it is very awesome.
Reply:If yo want a good compiler, Go to www.bloodshed.net and download the free Dev C++,
Good Luck
Omar
apricot
C++ array question - "removing" an item from an array?
If I had an array in C++, with a capacity of 10 items but only 5 items in the array, and I wanted to remove the item located at position 2 in the array...how would I go about doing that?
I just don't know the syntax...I know that to delete an entire array, you would type:
delete [] array;
But for just deleting one item, you can't do something like:
delete array[2];
So how would I go about removing that item? Just set it to zero and move everything else over to fill the gap (putting a zero in the last occupied location of the array), use the null factor or what?
C++ array question - "removing" an item from an array?
Depending on what you want to acheive, resorting an array maybe a waste of time. Array are not the best data structure to insert and delete. Depending on how often you gonna do this operation and the size of your array, this might not be a good idea performence wise.
I usually give a null value to the value I want out and ignore it whenever I browse through the array. If you intend to add and delete stuff from your array very often, your maybe better off with a chained list.
Reply:First delete [] array is only to be used to delete an array created with new [] array. If you want to remove an element from a static array then you will have to copy the remaining elements to the one you wish to remove. For example
int array[10];
//Assume elements placed into array
for (int i(2); i %26lt; 9; ++i)
array[i] = array[i + 1];
array[9] = 0;
However C++ has something called the standard template library (STL), this is a library as defined by ISO/ANSI as a part of C++, it contains template funcitons and containers, by far the most used container is vector which is a variable length array. The previous example would become
std::vector%26lt;int%26gt; array;
//Assume elements placed into the vector
array.erase(array.begin() + 2);
This is shorter and easier to use, if you want to know more about the STL then read Accelerated C++ by Andrew Koeing and Barberer E. Moo.
Reply:Just a couple of quick notes. The first poster is correct in saying that you can just move each element forward one space and overwrite the element you wish to delete. However, there is a caveat. If the element you wish to delete is a pointer to something that's been allocated using the new operator, you should explicitly delete it first before you overwrite it.
The second poster has a good point, although chained lists are more normally called linked lists.
Third, you can implement the 1st posters suggestion using 1 line using the movemem() function, which would be faster. But it's easier to screw that up, so I wouldn't recommend it unless you need every bit of speed.
Reply:While the most popular method is to move items ahead when deleting (as presented above), there is another way. By moving all the items down in the array you would not have to worry about overflowing your array when using a more familiar looking for loop.
//code begin
int removeIndex = 2;
int arrayLength = 10;
for(int i = removeIndex + 1; i %26lt; arrayLength; i++)
{
array[i-1] = array[i];
}
arrayLength--;
//end code
The other information about using delete and checking for invalid removal indexes is applicable, but this code does the trick as well.
Reply:Hello
You don't need to set it to zero. Do a FOR function that goes from the desired deletion point to the end that moves a[n+1] into n. So just move all the positions from the desired point one position back. Do a function and appeal it.
function delarraypos (int n)
{ cin%26gt;%26gt;n; //desired position
for (i=n;i%26lt;=m;i++) //m is array length
a[n]=a[n+1]
}
Reply:Mihai is largely correct, but here are a few more things to be aware of if you are to use his code:
function delarraypos (int n)
{ cin%26gt;%26gt;n; //desired position
for (i=n;i%26lt;=m;i++) //m is array length
a[n]=a[n+1]
}
1. The second element of an array is not array[2], so make sure that you either decrement n or pass in the proper index of the item you want to delete.
2. If the array length is m, the indices are 0 through m-1, so you don't want to go until m. Also, since you are going to set a[n]=a[n+1], going all the way to the end will make a[n+1] go past the end of the array, so you really only want to iterate to m-2.
3. The last element of the array will be left as it is if you do this. If you want to indicate unused elements of the array with 0, then you need to set array[m-1]=0. This will be important if the element to be deleted is at the end of the array, where there is nothing to move on top of it, if you want to make sure that it is not left with a non-0 value.
4. If you are concerned with a memory leak due to the array being populated with objects that have been "newed" elsewhere, then you still need to do a "delete array[2]" before rearranging the array to make sure the memory is freed up. Your example of setting the unused elements to 0 implies that this is an array of integers. If that is the case, then there is no need to delete the integer.
5. If the array's current length "m" is being stored somewhere, you will want to decrement it. (By "current lenngth," I mean how much of the array is filled as opposed to how much memory has been allocated for the array.)
6. Finally, unless you can be sure that the n value being passed in is good, it is good practice to check that n%26gt;=0 and n%26lt;m, and either throw an exception or assert out. If n is too big, this procedure will mess seriously with your memory in a way that will be hard to track down.
Hope this helps.
I just don't know the syntax...I know that to delete an entire array, you would type:
delete [] array;
But for just deleting one item, you can't do something like:
delete array[2];
So how would I go about removing that item? Just set it to zero and move everything else over to fill the gap (putting a zero in the last occupied location of the array), use the null factor or what?
C++ array question - "removing" an item from an array?
Depending on what you want to acheive, resorting an array maybe a waste of time. Array are not the best data structure to insert and delete. Depending on how often you gonna do this operation and the size of your array, this might not be a good idea performence wise.
I usually give a null value to the value I want out and ignore it whenever I browse through the array. If you intend to add and delete stuff from your array very often, your maybe better off with a chained list.
Reply:First delete [] array is only to be used to delete an array created with new [] array. If you want to remove an element from a static array then you will have to copy the remaining elements to the one you wish to remove. For example
int array[10];
//Assume elements placed into array
for (int i(2); i %26lt; 9; ++i)
array[i] = array[i + 1];
array[9] = 0;
However C++ has something called the standard template library (STL), this is a library as defined by ISO/ANSI as a part of C++, it contains template funcitons and containers, by far the most used container is vector which is a variable length array. The previous example would become
std::vector%26lt;int%26gt; array;
//Assume elements placed into the vector
array.erase(array.begin() + 2);
This is shorter and easier to use, if you want to know more about the STL then read Accelerated C++ by Andrew Koeing and Barberer E. Moo.
Reply:Just a couple of quick notes. The first poster is correct in saying that you can just move each element forward one space and overwrite the element you wish to delete. However, there is a caveat. If the element you wish to delete is a pointer to something that's been allocated using the new operator, you should explicitly delete it first before you overwrite it.
The second poster has a good point, although chained lists are more normally called linked lists.
Third, you can implement the 1st posters suggestion using 1 line using the movemem() function, which would be faster. But it's easier to screw that up, so I wouldn't recommend it unless you need every bit of speed.
Reply:While the most popular method is to move items ahead when deleting (as presented above), there is another way. By moving all the items down in the array you would not have to worry about overflowing your array when using a more familiar looking for loop.
//code begin
int removeIndex = 2;
int arrayLength = 10;
for(int i = removeIndex + 1; i %26lt; arrayLength; i++)
{
array[i-1] = array[i];
}
arrayLength--;
//end code
The other information about using delete and checking for invalid removal indexes is applicable, but this code does the trick as well.
Reply:Hello
You don't need to set it to zero. Do a FOR function that goes from the desired deletion point to the end that moves a[n+1] into n. So just move all the positions from the desired point one position back. Do a function and appeal it.
function delarraypos (int n)
{ cin%26gt;%26gt;n; //desired position
for (i=n;i%26lt;=m;i++) //m is array length
a[n]=a[n+1]
}
Reply:Mihai is largely correct, but here are a few more things to be aware of if you are to use his code:
function delarraypos (int n)
{ cin%26gt;%26gt;n; //desired position
for (i=n;i%26lt;=m;i++) //m is array length
a[n]=a[n+1]
}
1. The second element of an array is not array[2], so make sure that you either decrement n or pass in the proper index of the item you want to delete.
2. If the array length is m, the indices are 0 through m-1, so you don't want to go until m. Also, since you are going to set a[n]=a[n+1], going all the way to the end will make a[n+1] go past the end of the array, so you really only want to iterate to m-2.
3. The last element of the array will be left as it is if you do this. If you want to indicate unused elements of the array with 0, then you need to set array[m-1]=0. This will be important if the element to be deleted is at the end of the array, where there is nothing to move on top of it, if you want to make sure that it is not left with a non-0 value.
4. If you are concerned with a memory leak due to the array being populated with objects that have been "newed" elsewhere, then you still need to do a "delete array[2]" before rearranging the array to make sure the memory is freed up. Your example of setting the unused elements to 0 implies that this is an array of integers. If that is the case, then there is no need to delete the integer.
5. If the array's current length "m" is being stored somewhere, you will want to decrement it. (By "current lenngth," I mean how much of the array is filled as opposed to how much memory has been allocated for the array.)
6. Finally, unless you can be sure that the n value being passed in is good, it is good practice to check that n%26gt;=0 and n%26lt;m, and either throw an exception or assert out. If n is too big, this procedure will mess seriously with your memory in a way that will be hard to track down.
Hope this helps.
Help for visual C# programming?
I was looking for codes/syntax for a game called "Three Shell Game"....its a simple game where there is 3 cups, and a pea or coin is put under one of the cup. The person then tries to guess where the coin is after the cups are move around quickly by owner. But I was looking at making this into a visual C# program...does anyone have codes or program codes for this kind of game or can help me? I only have basic skills on visual C# at the moment
Help for visual C# programming?
Is that game your talikng about is flash game?..... try to download a flash decompiler and see the of the game.. it is a bit similar to c++.
Reply:May be you can contact a C# expert at website like http://askexpert.info/
Help for visual C# programming?
Is that game your talikng about is flash game?..... try to download a flash decompiler and see the of the game.. it is a bit similar to c++.
Reply:May be you can contact a C# expert at website like http://askexpert.info/
C++ date code question?
The following syntax performs what type of function?
Date vDay(2,14,1993);
a)performs no function
b) overwrites the previously defined variable vDay
c) calls an operating system funciton to set the date
d) defines a new object variable
Thanks to anyone who posts.
C++ date code question?
Technically, e) for none of the above. But given those choices then d).
The reason d) is technically wrong is that you define a TYPE not a variable. The type Date is "defined" somewhere else. This code is just instantiating an object of that type.
Reply:d)
Date vDay(2,14,1993);
a)performs no function
b) overwrites the previously defined variable vDay
c) calls an operating system funciton to set the date
d) defines a new object variable
Thanks to anyone who posts.
C++ date code question?
Technically, e) for none of the above. But given those choices then d).
The reason d) is technically wrong is that you define a TYPE not a variable. The type Date is "defined" somewhere else. This code is just instantiating an object of that type.
Reply:d)
Need help with io in C++, have read much programmed little?
I am somewhat familiar with input/output in programming, but am having problems using file io in C++. This is my skeleton type program:
#include %26lt;stdio.h%26gt;
#include %26lt;fstream.h%26gt;
int main(int argc, char *argv[])
{ ifstream filein; ofstream fileout; char ch;
filein.open("input.txt", ios::in);
fileout.open("output.txt", ios::out);
for(filein.get(ch); ch!=EOF; filein.get(ch));
{
fileout.put(ch);
}
filein.close();
fileout.close();
return 0;
}
i created a text file input.txt and output.txt, input has "asd" in it and output is empty, i want it to write the asd to output.txt
using EOF it is infinite loop, and using NULL it terminates doing nothing, I have read a lot about c/c++ but this is my first stab at programming in it and it is taking me forever to get all syntax and small stuff takin care of. Please tell me what I am doing wrong. Thank you :)
Need help with io in C++, have read much programmed little?
http://www.cplusplus.com/doc/tutorial/fi...
Please get a better book. The above code is terrible. And outdated.
Just open up two filestreams and transfer one line to another. Use getline to take in entire lines. Store them in strings. As in %26lt;string%26gt; strings.
EDIT: I'll give you the code. Please get a newer book so you understand what I did.
#include %26lt;iostream%26gt;
#include %26lt;fstream%26gt;
#include %26lt;string%26gt;
using namespace std;
int main()
{
string str;
ifstream infile("input.txt");
ofstream outfile("output.txt");
if (infile.is_open())
{
while (!infile.eof() )
{
getline(infile, str);
outfile %26lt;%26lt; str %26lt;%26lt; endl;
}
infile.close();
outfile.close();
}
else cout %26lt;%26lt; "Unable to open file";
return 0;
}
Reply:use ifstream::in and ifstream::out instead!
song words
#include %26lt;stdio.h%26gt;
#include %26lt;fstream.h%26gt;
int main(int argc, char *argv[])
{ ifstream filein; ofstream fileout; char ch;
filein.open("input.txt", ios::in);
fileout.open("output.txt", ios::out);
for(filein.get(ch); ch!=EOF; filein.get(ch));
{
fileout.put(ch);
}
filein.close();
fileout.close();
return 0;
}
i created a text file input.txt and output.txt, input has "asd" in it and output is empty, i want it to write the asd to output.txt
using EOF it is infinite loop, and using NULL it terminates doing nothing, I have read a lot about c/c++ but this is my first stab at programming in it and it is taking me forever to get all syntax and small stuff takin care of. Please tell me what I am doing wrong. Thank you :)
Need help with io in C++, have read much programmed little?
http://www.cplusplus.com/doc/tutorial/fi...
Please get a better book. The above code is terrible. And outdated.
Just open up two filestreams and transfer one line to another. Use getline to take in entire lines. Store them in strings. As in %26lt;string%26gt; strings.
EDIT: I'll give you the code. Please get a newer book so you understand what I did.
#include %26lt;iostream%26gt;
#include %26lt;fstream%26gt;
#include %26lt;string%26gt;
using namespace std;
int main()
{
string str;
ifstream infile("input.txt");
ofstream outfile("output.txt");
if (infile.is_open())
{
while (!infile.eof() )
{
getline(infile, str);
outfile %26lt;%26lt; str %26lt;%26lt; endl;
}
infile.close();
outfile.close();
}
else cout %26lt;%26lt; "Unable to open file";
return 0;
}
Reply:use ifstream::in and ifstream::out instead!
song words
A random word program for c?
Im trying to write a program that will print 8 random words...they dont have to be real words.
The number of characters in the word must also be random...I have some syntax errors and I dont know why!!!!
%26lt;code snippet%26gt;
#define MinLetters 1
#define MaxLetters 9
char RandomWord(void);
main()
{
int n;
printf(" This program generates 8 random words.\n");
for(n = 1; n %26lt;= 8; n++)
{
printf("%c", RandomWord());
}
}
char RandomWord(void)
{
int i, j;
i = RandomInteger(int MinLetters, int MaxLetters);
for(j = 1; j %26lt;= i j++)
{
return (RandomInteger('A', 'Z');
}
printf("\n")
}
%26lt;/code snippet%26gt;
I have syntax errors in RandomWord before 'int' and before 'j'
Anybody feel like being a god???? lol
Thanks in advance guys...hopefully if I figure this language out I can answer some questions instead of asking
A random word program for c?
i = RandomInteger(int MinLetters, int MaxLetters);
needs to be changed to
i = RandomInteger(MinLetters, MaxLetters);
Also where is the seed value for random number generation?
The number of characters in the word must also be random...I have some syntax errors and I dont know why!!!!
%26lt;code snippet%26gt;
#define MinLetters 1
#define MaxLetters 9
char RandomWord(void);
main()
{
int n;
printf(" This program generates 8 random words.\n");
for(n = 1; n %26lt;= 8; n++)
{
printf("%c", RandomWord());
}
}
char RandomWord(void)
{
int i, j;
i = RandomInteger(int MinLetters, int MaxLetters);
for(j = 1; j %26lt;= i j++)
{
return (RandomInteger('A', 'Z');
}
printf("\n")
}
%26lt;/code snippet%26gt;
I have syntax errors in RandomWord before 'int' and before 'j'
Anybody feel like being a god???? lol
Thanks in advance guys...hopefully if I figure this language out I can answer some questions instead of asking
A random word program for c?
i = RandomInteger(int MinLetters, int MaxLetters);
needs to be changed to
i = RandomInteger(MinLetters, MaxLetters);
Also where is the seed value for random number generation?
Using namespace std; - this statement is giving an error in C++...?
error is "declaration syntax error"..Whats the reason behind this?? while I am using Turbo C++ 3 or 4.5 version........
Using namespace std; - this statement is giving an error in C++...?
you have a problem with your compiler ....check your compiler setting.
Reply:using namespace std;
sounds more like VC++ or Managed C++.
In Turbo C++, it is likely
#include %26lt;stdio.h%26gt;
Reply:Don't use that (Using namespace std;) in Turbo C++ instead use this (#include %26lt;stdio.h%26gt;) .
Hope it helps. ^^
Reply:check for uppercase letter mistakes. statement should work.
Using namespace std; - this statement is giving an error in C++...?
you have a problem with your compiler ....check your compiler setting.
Reply:using namespace std;
sounds more like VC++ or Managed C++.
In Turbo C++, it is likely
#include %26lt;stdio.h%26gt;
Reply:Don't use that (Using namespace std;) in Turbo C++ instead use this (#include %26lt;stdio.h%26gt;) .
Hope it helps. ^^
Reply:check for uppercase letter mistakes. statement should work.
I have to make a big decission! It is Microsoft C# or Linux C! I know just a little bit about c#!?
I know nothing about C!
In the same time I want to catch up with the latest stuff and go with C# but I also want to learn about C in Linux, sockets and a liitle bit of lower level like C(do not give me assembly)
I do not know wich one to start off with first and every single time I decide on something, I try and find tutorials, but I suddenly feel that want to go back to the other one! It is a weird feeling and I also think I got some mental problem ! Please help me with this and do not tell me to look on the other discovered questions!
Could I go with both at the same time since they have a similar syntax?? (not really similar but close)
I have to make a big decission! It is Microsoft C# or Linux C! I know just a little bit about c#!?
I vote for MS C#. I love their new Visual Studio.
Reply:Wow, you are really being pulled in 2 directions here. Coding C on Linux is about as far from C# as you can get. It will probably be in your benefit to learn C very well (especially pointers) and then move onto C++ before really understanding C#. C# may look incredibly simple, and it is, but internally it is very complicated. Fortunately, you rarely have to worry about this complications, but sometimes it will become important, and the average ignorant C# code won't know how or why something is performing as it is. Note that C# can run on Linux too (lookup Mono).
Reply:Learn C# simply because of money. C# programmers can easily make 100,000 a year with just 4 years experience. C programmers are a dime a dozen and average 60-70K a year. C# is quickly becoming the standard in most shops and people are needed. C is old and is not built well and will confuse you when you want to make the jump to C#. C# is highly object-oriented while C is more procedural. That's like asking - should I learn to use an abacus or a calculator... I'd choose calculator any day.
Reply:read these links hope thins help...start with ANSI C then go ahead with c++
happy coding :)
Cheerz, Steven
Reply:You know, if you get the VS C++ Express and VS C# from Microsoft, you can learn both, as far as sockets and networking, those API's are system dependent, basically, the way you make it in Linux is different to the way you do it in Windows, even if you are using plain C.
C# is a proprietary Microsoft language which gives access to the Microsoft .NET framework (basically a big API arranged by namespaces), all Networking API in Windows and Linux can be accessed using C++, all C functions can also be called by C++, only if you use Gnome GUI programming you will have to use C, but I am sure you can always link the libraries to C++.
Bottom line, learn basic C++, learn the basic algorithms as loops, if else, recursion, array and string manipulation, etc.
Once you master the basic algorithms, start learning learning the use of libraries or APIs.
If you understand the principles and logic of algorithms, you can apply the same logic to any language (C, C++, C#, Java, VB, etc), learning the syntax can be a few hours depending on how good and experienced you are.
The hardest part is learning the API, because you have to go through all the functions available and figure out what they do and how to use it, for example, Microsoft has the platform SDK for Windows Programming which is in C or C++, MFC is C++ Windows programming, COM is for Windows and its C++, VB has its own Windows API which are kind of similar to the Platform SDK and .NET, which shares it's namespace in all the .NET languages (C#, VB.NET, Managed C++ and J#)
If you want to take C#, you will still need to learn the logic and algorithms before using the Windows libraries to make GUIs, otherwise you will be a cookie cutter developer.
Go to microsoft.com and get the Visual Studio Express version, they are FREE and come with tutorials.
Reply:Just FYI, C# and C are nothing alike.
Reply:Learn C first. Some may argue "learn C# first, it's easier", but in reality C# is very similar to C++, which is based on C. If you want to be any kind of efficient programmer in C++ or C# you should learn C. Then learning C++ after that is a breeze, and then learn C#, which if you know C++ is really just a matter of slight syntax changes and learning all the .NET System namespace. Also, once you learn the .NET stuff, you give yourself a huge boost into other languages that use the .NET library, such as C++ in .NET, VB.NET, etc.
In the same time I want to catch up with the latest stuff and go with C# but I also want to learn about C in Linux, sockets and a liitle bit of lower level like C(do not give me assembly)
I do not know wich one to start off with first and every single time I decide on something, I try and find tutorials, but I suddenly feel that want to go back to the other one! It is a weird feeling and I also think I got some mental problem ! Please help me with this and do not tell me to look on the other discovered questions!
Could I go with both at the same time since they have a similar syntax?? (not really similar but close)
I have to make a big decission! It is Microsoft C# or Linux C! I know just a little bit about c#!?
I vote for MS C#. I love their new Visual Studio.
Reply:Wow, you are really being pulled in 2 directions here. Coding C on Linux is about as far from C# as you can get. It will probably be in your benefit to learn C very well (especially pointers) and then move onto C++ before really understanding C#. C# may look incredibly simple, and it is, but internally it is very complicated. Fortunately, you rarely have to worry about this complications, but sometimes it will become important, and the average ignorant C# code won't know how or why something is performing as it is. Note that C# can run on Linux too (lookup Mono).
Reply:Learn C# simply because of money. C# programmers can easily make 100,000 a year with just 4 years experience. C programmers are a dime a dozen and average 60-70K a year. C# is quickly becoming the standard in most shops and people are needed. C is old and is not built well and will confuse you when you want to make the jump to C#. C# is highly object-oriented while C is more procedural. That's like asking - should I learn to use an abacus or a calculator... I'd choose calculator any day.
Reply:read these links hope thins help...start with ANSI C then go ahead with c++
happy coding :)
Cheerz, Steven
Reply:You know, if you get the VS C++ Express and VS C# from Microsoft, you can learn both, as far as sockets and networking, those API's are system dependent, basically, the way you make it in Linux is different to the way you do it in Windows, even if you are using plain C.
C# is a proprietary Microsoft language which gives access to the Microsoft .NET framework (basically a big API arranged by namespaces), all Networking API in Windows and Linux can be accessed using C++, all C functions can also be called by C++, only if you use Gnome GUI programming you will have to use C, but I am sure you can always link the libraries to C++.
Bottom line, learn basic C++, learn the basic algorithms as loops, if else, recursion, array and string manipulation, etc.
Once you master the basic algorithms, start learning learning the use of libraries or APIs.
If you understand the principles and logic of algorithms, you can apply the same logic to any language (C, C++, C#, Java, VB, etc), learning the syntax can be a few hours depending on how good and experienced you are.
The hardest part is learning the API, because you have to go through all the functions available and figure out what they do and how to use it, for example, Microsoft has the platform SDK for Windows Programming which is in C or C++, MFC is C++ Windows programming, COM is for Windows and its C++, VB has its own Windows API which are kind of similar to the Platform SDK and .NET, which shares it's namespace in all the .NET languages (C#, VB.NET, Managed C++ and J#)
If you want to take C#, you will still need to learn the logic and algorithms before using the Windows libraries to make GUIs, otherwise you will be a cookie cutter developer.
Go to microsoft.com and get the Visual Studio Express version, they are FREE and come with tutorials.
Reply:Just FYI, C# and C are nothing alike.
Reply:Learn C first. Some may argue "learn C# first, it's easier", but in reality C# is very similar to C++, which is based on C. If you want to be any kind of efficient programmer in C++ or C# you should learn C. Then learning C++ after that is a breeze, and then learn C#, which if you know C++ is really just a matter of slight syntax changes and learning all the .NET System namespace. Also, once you learn the .NET stuff, you give yourself a huge boost into other languages that use the .NET library, such as C++ in .NET, VB.NET, etc.
How to draw a circle in c++?
i want to draw a simple cirlce in c++. dont send me the sample file present in help.just explain me the syntax of circle()function in graphics.h
How to draw a circle in c++?
The syntax is:
void circle(int x, int y, int radius);
x/y specify the coordinates of the centre. Radius is the distance from the centre to circle's edge.
Reply:what is c++?? if it is cad, or autocad program then there is an icon to select then specifiy the radius, or diamiter in paranthasis.
song titles
How to draw a circle in c++?
The syntax is:
void circle(int x, int y, int radius);
x/y specify the coordinates of the centre. Radius is the distance from the centre to circle's edge.
Reply:what is c++?? if it is cad, or autocad program then there is an icon to select then specifiy the radius, or diamiter in paranthasis.
song titles
Simple C++ assembly?
I'm using Visual C++. I try this inline code:
__asm{
movl %esp,%eax
};
and I get this error:
inline assembler syntax error in 'opcode'; found 'MOD'
How do I fix this?
Simple C++ assembly?
Try this
__asm{
mov esp,eax
};
It Compiles.
I am not into inline assembly for long. I am sorry if I have misguided you.
Reply:Or else you may contact an assembly expert. Check websites like http://askexpert.info/
__asm{
movl %esp,%eax
};
and I get this error:
inline assembler syntax error in 'opcode'; found 'MOD'
How do I fix this?
Simple C++ assembly?
Try this
__asm{
mov esp,eax
};
It Compiles.
I am not into inline assembly for long. I am sorry if I have misguided you.
Reply:Or else you may contact an assembly expert. Check websites like http://askexpert.info/
For C++ programmers ONLY?
I have created a small program that is all about "Banking Systems".
I want my user to print all important data using a printer. How will I do this using C++? I am using the Turbo C++ 4.5 compiler.
If you knew any website that is related to my question, please post its address but if you know the codes, just please write the most-important syntax or semantics that is responsible for printing. I am not encouraging you to write the entire code, just a piece of code or module that is basically the most important code for printing.
Thanks in advance
PS: The first answerer to answer my question correctly will gain 10 points + 5 stars + thumbs-up.
For C++ programmers ONLY?
I think that the proper way of doing that under TurboC++ was to open an output "file" with the name of "LPT1:" or "COM1:" or wherever your printer is attached. You can then use any file output methods like fprintf(...)
If I am remembering too far back for TurboC++ 4.5, then sorry and never mind.
Reply:Thank you very much sir. Sorry that I forgot to reward the best answerer because of my hectic schedule. Unfortunately, I supposed to choose "cod" as the best answerer because the codes work and the site really helps me a lot but your answer is also helpful. Thank you very much and God bless! Report It
Reply:If you work under Windows (and not on DOS) you can print the document through the API
OpenPrinter
StartDocPrint ...
see www.codeproject.com
Reply:http://www.bloggerspedia.com/story.php?t...
I want my user to print all important data using a printer. How will I do this using C++? I am using the Turbo C++ 4.5 compiler.
If you knew any website that is related to my question, please post its address but if you know the codes, just please write the most-important syntax or semantics that is responsible for printing. I am not encouraging you to write the entire code, just a piece of code or module that is basically the most important code for printing.
Thanks in advance
PS: The first answerer to answer my question correctly will gain 10 points + 5 stars + thumbs-up.
For C++ programmers ONLY?
I think that the proper way of doing that under TurboC++ was to open an output "file" with the name of "LPT1:" or "COM1:" or wherever your printer is attached. You can then use any file output methods like fprintf(...)
If I am remembering too far back for TurboC++ 4.5, then sorry and never mind.
Reply:Thank you very much sir. Sorry that I forgot to reward the best answerer because of my hectic schedule. Unfortunately, I supposed to choose "cod" as the best answerer because the codes work and the site really helps me a lot but your answer is also helpful. Thank you very much and God bless! Report It
Reply:If you work under Windows (and not on DOS) you can print the document through the API
OpenPrinter
StartDocPrint ...
see www.codeproject.com
Reply:http://www.bloggerspedia.com/story.php?t...
How to initialise a 2D array in C++?
Hello,
How do I initialise a global 2D arary in C++?
First, I declared the 2D array outside of the main function.
int data[32][5];
Then in the main function, I initialized the array:
data[32][5] = {{0,0,0,0,0},
{0,0,0,0,1},{0,0,0,1,0},{0,0,0,1,1},{0...
......................................... integers here)..........
{1,1,1,1,1}};
The above is what I typed into visual c++ 2005. After the comma of every 5th bracket, I pressed 'Enter' to go to a new line.
However, when I compiled, there were syntax errors saying that there are missing ; before '{' or '}' .
What is the syntax error?
How to initialise a 2D array in C++?
is your declaration is correct
it should be defined as:
public int data[][];
public int main()
{
data[32][5]={{.......}{.......}{.........
}
How do I initialise a global 2D arary in C++?
First, I declared the 2D array outside of the main function.
int data[32][5];
Then in the main function, I initialized the array:
data[32][5] = {{0,0,0,0,0},
{0,0,0,0,1},{0,0,0,1,0},{0,0,0,1,1},{0...
......................................... integers here)..........
{1,1,1,1,1}};
The above is what I typed into visual c++ 2005. After the comma of every 5th bracket, I pressed 'Enter' to go to a new line.
However, when I compiled, there were syntax errors saying that there are missing ; before '{' or '}' .
What is the syntax error?
How to initialise a 2D array in C++?
is your declaration is correct
it should be defined as:
public int data[][];
public int main()
{
data[32][5]={{.......}{.......}{.........
}
Which C++ book is good for me?
I am a begginer in programming C++ , and I want to buy a book with which I can improve my abilities in programming.
I already know some basic stuff like variables and constans and simple input and output and basic functions, and also loops and if statements and some other very basic things.
I am NOT looking for books which have definitions and just tell me which syntax does what, I actually want a book that has exercises in it and gets me to test my knowledge
and programming skills in a real way, and gives me a little bit of experience how you should model real time stuff with C++,
If you have read or you know a book which is good for this purpose, please let me know
Thank you
Which C++ book is good for me?
C++ Cookbook. Why not learn from real-world recipes? This is actually a very helpful book and will remove you from the stone-age from what other books %26amp; tutorials will offer you. I'm not doing any C++ from day to day but I do own the book and found it very helpful in the past.
Also, if you really want to improve your skills learn unit testing. There is a nice framework for C++ called csUnit. Unit testing other's code will help you out tremendously.
Reply:Complete reference C++
Auth: Herbert Schield
Pub: McGrawHill
he takes u from the very basic to industry implementation level...
Reply:"in the past I bought several beginner to intermidiate books , but all of them give you definitions and examples and told me about different things which do different jobs for example they told me about different loops and how they work and the syntax for each of them and different variables and how each of them works like signed short and signed long and char and bool and a whole bunch of other stuff but they never showed me how a simple program is written and the books didnt have any excercises with answers, and after I read these chapters I douldnt write the most basic stuff, except for simple input and output that you give the computer some numbers and it does some stuff on it and gives it back to you and this is nothing, I wanna learn to USE the loops and functions and if statements and operations that I learned in definition."
Didn't they teach you in school to AVOID run-on sentences?
My first advice is to always stay away from Herbert Schildt.
My second advice is to give "Ivor Horton's Beginning ANSI C++ - The Complete Language" a try: http://www.amazon.com/dp/1590592271/
song downloads
I already know some basic stuff like variables and constans and simple input and output and basic functions, and also loops and if statements and some other very basic things.
I am NOT looking for books which have definitions and just tell me which syntax does what, I actually want a book that has exercises in it and gets me to test my knowledge
and programming skills in a real way, and gives me a little bit of experience how you should model real time stuff with C++,
If you have read or you know a book which is good for this purpose, please let me know
Thank you
Which C++ book is good for me?
C++ Cookbook. Why not learn from real-world recipes? This is actually a very helpful book and will remove you from the stone-age from what other books %26amp; tutorials will offer you. I'm not doing any C++ from day to day but I do own the book and found it very helpful in the past.
Also, if you really want to improve your skills learn unit testing. There is a nice framework for C++ called csUnit. Unit testing other's code will help you out tremendously.
Reply:Complete reference C++
Auth: Herbert Schield
Pub: McGrawHill
he takes u from the very basic to industry implementation level...
Reply:"in the past I bought several beginner to intermidiate books , but all of them give you definitions and examples and told me about different things which do different jobs for example they told me about different loops and how they work and the syntax for each of them and different variables and how each of them works like signed short and signed long and char and bool and a whole bunch of other stuff but they never showed me how a simple program is written and the books didnt have any excercises with answers, and after I read these chapters I douldnt write the most basic stuff, except for simple input and output that you give the computer some numbers and it does some stuff on it and gives it back to you and this is nothing, I wanna learn to USE the loops and functions and if statements and operations that I learned in definition."
Didn't they teach you in school to AVOID run-on sentences?
My first advice is to always stay away from Herbert Schildt.
My second advice is to give "Ivor Horton's Beginning ANSI C++ - The Complete Language" a try: http://www.amazon.com/dp/1590592271/
song downloads
Need help understanding a simple C function?
Hi, I know java but am new to C. Although I do have the concept of what pointers are but I am not familiar with the syntax. Would somebody please explain the statements that involve the use of asterisks in the following function?
(Particularly the one that starts with a*)
void allocate_2d_array (int r, int c, double ***a)
{
double *storage;
int i;
storage = (double *) malloc (r * c * sizeof(double));
*a = (double **) malloc (r * sizeof(double *));
for (i = 0; i %26lt; r; i++)
(*a)[i] = %26amp;storage[i * c];
}
Thank you very much for your help.
Need help understanding a simple C function?
Okay, there are two symbols which are relevant in talking about pointers in C (as an aside, in C++ they are slightly extended so people can get confused. In particular %26amp; has one other meaning related to addresses). The two symbols are %26amp; which can be understood as "The Address of" and * which is "Pointer to".
Thus this function has 3 parameters coming in:
r: the number of elements in the array
c: the multiplier
and a pointer to a pointer to a pointer to a. Got that?
The first thing which is declared is a pointer to the array storage. Then we get the counter int, i, but we'll skip over that.
All storage is is an area of memory large enough to hold the address of a double (which is large enough to hold a pointer to an array of doubles, because arrays are usually passed as a pointer to the first element). That's why the storage= line is necessary. It sets aside a block of memory which is r*c*the size of a double bytes long. Since it uses malloc() which returns a void * it is necessary to cast the pointer as a double for it to be useable. That is what the (double *) does.
The next line I can parse better than I can understand. The an area of memory the size of a double * r is allocated, then cast as a pointer to a pointer, which is assigned to the address which is pointed to by a.
The line after that clarifies it a little, if you understand something called pointer decay. What this means is that since parameters are passed as values -- that is new variables are created in each function into which the values in the old variables are copied EXCEPT arrays which are passed as pointers to array[0] -- the address of the first element -- pointers to arrays and arrays can be treated exactly the same way. Each element in the array pointed to by a is assigned the address (the %26amp; operator) of the element in storage at i*c. Thus *a[0]==%26amp;storage[0], *a[1]==%26amp;storage[c], *a[2]==%26amp;storage[2c]... This is why this helps explain the above. It's an array of pointers to doubles.
The subject, as you can tell is very gnarly, and I'm pressed for time, I'm sorry to say. I'll leave you with a link in sources (which I did use) about pointer decay.
Reply:*a is a pointer variable. **a is a pointer to pointer. storage is apointer variable here.
and it has allocated memory dynamically using malloc.
Its syntax to allocate memory is (type of pointer variable)malloc(size).
(Particularly the one that starts with a*)
void allocate_2d_array (int r, int c, double ***a)
{
double *storage;
int i;
storage = (double *) malloc (r * c * sizeof(double));
*a = (double **) malloc (r * sizeof(double *));
for (i = 0; i %26lt; r; i++)
(*a)[i] = %26amp;storage[i * c];
}
Thank you very much for your help.
Need help understanding a simple C function?
Okay, there are two symbols which are relevant in talking about pointers in C (as an aside, in C++ they are slightly extended so people can get confused. In particular %26amp; has one other meaning related to addresses). The two symbols are %26amp; which can be understood as "The Address of" and * which is "Pointer to".
Thus this function has 3 parameters coming in:
r: the number of elements in the array
c: the multiplier
and a pointer to a pointer to a pointer to a. Got that?
The first thing which is declared is a pointer to the array storage. Then we get the counter int, i, but we'll skip over that.
All storage is is an area of memory large enough to hold the address of a double (which is large enough to hold a pointer to an array of doubles, because arrays are usually passed as a pointer to the first element). That's why the storage= line is necessary. It sets aside a block of memory which is r*c*the size of a double bytes long. Since it uses malloc() which returns a void * it is necessary to cast the pointer as a double for it to be useable. That is what the (double *) does.
The next line I can parse better than I can understand. The an area of memory the size of a double * r is allocated, then cast as a pointer to a pointer, which is assigned to the address which is pointed to by a.
The line after that clarifies it a little, if you understand something called pointer decay. What this means is that since parameters are passed as values -- that is new variables are created in each function into which the values in the old variables are copied EXCEPT arrays which are passed as pointers to array[0] -- the address of the first element -- pointers to arrays and arrays can be treated exactly the same way. Each element in the array pointed to by a is assigned the address (the %26amp; operator) of the element in storage at i*c. Thus *a[0]==%26amp;storage[0], *a[1]==%26amp;storage[c], *a[2]==%26amp;storage[2c]... This is why this helps explain the above. It's an array of pointers to doubles.
The subject, as you can tell is very gnarly, and I'm pressed for time, I'm sorry to say. I'll leave you with a link in sources (which I did use) about pointer decay.
Reply:*a is a pointer variable. **a is a pointer to pointer. storage is apointer variable here.
and it has allocated memory dynamically using malloc.
Its syntax to allocate memory is (type of pointer variable)malloc(size).
Help with C programming?
i am writing a quick sort program for a C programming class and I can't tell what's wrong. I am getting syntax errors like "[Warning] parameter names(without types in function declaration" and "previous definition of 'sort_nums' was here." What do these mean and how do I fix them. Also I am using recursion if that makes a difference
Help with C programming?
Hard to help you without seeing your source code. Sounds like you may have a problem with mixing up your function **declaration** with your function **defintion(s)**. Review the purpose of each of these things and HOW you do them, and remember that you don't NEED to have a definition at all unless you are calling a function whose DECLARATION is in a different source file or AFTER the call to it. If you do have multiple DEFINITIONs, make sure they are all consistent.
Reply:http://www.cprogramming.com/tutorial.htm...
This link might have what you want. I'm not too up on my C programming
Reply:Now you can call quickSort function ijn your Main Program.
///////////Function To Call Quick Sort//////////
void quickSort(int numbers[], int array_size)
{
q_sort(numbers, 0, array_size - 1);
}
///////////Function To Call Quick Sort//////////
void q_sort(int numbers[], int left, int right)
{
int pivot, l_hold, r_hold;
l_hold = left;
r_hold = right;
pivot = numbers[left];
while (left %26lt; right)
{
while ((numbers[right] %26gt;= pivot) %26amp;%26amp; (left %26lt; right))
right--;
if (left != right)
{
numbers[left] = numbers[right];
left++;
}
while ((numbers[left] %26lt;= pivot) %26amp;%26amp; (left %26lt; right))
left++;
if (left != right)
{
numbers[right] = numbers[left];
right--;
}
}
numbers[left] = pivot;
pivot = left;
left = l_hold;
right = r_hold;
if (left %26lt; pivot)
q_sort(numbers, left, pivot-1);
if (right %26gt; pivot)
q_sort(numbers, pivot+1, right);
}
Help with C programming?
Hard to help you without seeing your source code. Sounds like you may have a problem with mixing up your function **declaration** with your function **defintion(s)**. Review the purpose of each of these things and HOW you do them, and remember that you don't NEED to have a definition at all unless you are calling a function whose DECLARATION is in a different source file or AFTER the call to it. If you do have multiple DEFINITIONs, make sure they are all consistent.
Reply:http://www.cprogramming.com/tutorial.htm...
This link might have what you want. I'm not too up on my C programming
Reply:Now you can call quickSort function ijn your Main Program.
///////////Function To Call Quick Sort//////////
void quickSort(int numbers[], int array_size)
{
q_sort(numbers, 0, array_size - 1);
}
///////////Function To Call Quick Sort//////////
void q_sort(int numbers[], int left, int right)
{
int pivot, l_hold, r_hold;
l_hold = left;
r_hold = right;
pivot = numbers[left];
while (left %26lt; right)
{
while ((numbers[right] %26gt;= pivot) %26amp;%26amp; (left %26lt; right))
right--;
if (left != right)
{
numbers[left] = numbers[right];
left++;
}
while ((numbers[left] %26lt;= pivot) %26amp;%26amp; (left %26lt; right))
left++;
if (left != right)
{
numbers[right] = numbers[left];
right--;
}
}
numbers[left] = pivot;
pivot = left;
left = l_hold;
right = r_hold;
if (left %26lt; pivot)
q_sort(numbers, left, pivot-1);
if (right %26gt; pivot)
q_sort(numbers, pivot+1, right);
}
C code problem?
#include%26lt;stdio.h%26gt;
int calsum(int x,int y, int z);
main()
{
int a,b,c, sum;
printf("\n Enter any three numbers");
scanf("%d %d %d",%26amp;a, %26amp;b, %26amp;c);
sum = calsum(a,b,c);
printf("\nSum=%d",sum);
}
int calsum(int x,int y,int z)
int x,y,z,;
{
int d;
d=x+y+z;
return (d);
}
error messages is
function should return a value in function main()
declaration syntax error
deceleration terminated incorrectly
Plz tell me where I am wrong
C code problem?
#include%26lt;stdio.h%26gt;
int calsum(int x,int y, int z); **** write int calsum(int, int, int);
main()
{
int a,b,c, sum;
printf("\n Enter any three numbers");
scanf("%d %d %d",%26amp;a, %26amp;b, %26amp;c);
sum = calsum(a,b,c);
printf("\nSum=%d",sum);
}
int calsum(int x,int y,int z)
int x,y,z,; ****remove this
{
int d;
d=x+y+z;
return (d); ***use return d;
}
Please try then tell me if u still encounter error
Reply:main() should be void main()
replace the main() by void main()
Reply:return 0;
in main
Reply:The main method returns an integer value by default. Since in your code, no value is returned by the main(), the error occurs.
You may either choose to define main as
void main()
{
// your code goes here
}
or,
main()
{
// your code
return 0;
}
Reply:type return 0; in the last line in the main program. surely this will solve this problem
int calsum(int x,int y, int z);
main()
{
int a,b,c, sum;
printf("\n Enter any three numbers");
scanf("%d %d %d",%26amp;a, %26amp;b, %26amp;c);
sum = calsum(a,b,c);
printf("\nSum=%d",sum);
}
int calsum(int x,int y,int z)
int x,y,z,;
{
int d;
d=x+y+z;
return (d);
}
error messages is
function should return a value in function main()
declaration syntax error
deceleration terminated incorrectly
Plz tell me where I am wrong
C code problem?
#include%26lt;stdio.h%26gt;
int calsum(int x,int y, int z); **** write int calsum(int, int, int);
main()
{
int a,b,c, sum;
printf("\n Enter any three numbers");
scanf("%d %d %d",%26amp;a, %26amp;b, %26amp;c);
sum = calsum(a,b,c);
printf("\nSum=%d",sum);
}
int calsum(int x,int y,int z)
int x,y,z,; ****remove this
{
int d;
d=x+y+z;
return (d); ***use return d;
}
Please try then tell me if u still encounter error
Reply:main() should be void main()
replace the main() by void main()
Reply:return 0;
in main
Reply:The main method returns an integer value by default. Since in your code, no value is returned by the main(), the error occurs.
You may either choose to define main as
void main()
{
// your code goes here
}
or,
main()
{
// your code
return 0;
}
Reply:type return 0; in the last line in the main program. surely this will solve this problem
C# Questions - Please Help ASAP!?
i am having some difficulty with these C# questions! i will give you the questions and 4 possible answers, please can you provide me with the correct answer and please explain how you got that answer.... thanks in advance
1. What does the following algorithm produce when n is 3?
set sum to 10.
set i to 1.
input n.
while i is less than or equal to n do
{
take i from sum.
increment i.
}
output sum.
a. 9
b. 7
c. 4
d. 1
2. What would be output by the following section of code ?
int A[4] = {1 , 2, 3, 4};
int i;
for (i=0; i%26lt;4; i++)
{
A[i] = A[i] + A[i];
}
Console.WriteLine (A[i] );
a. 4
b. 0
c. 8
d. 6
3. Given the following method (you may assume it has all compiled correctly so there are no syntax errors), what will be output?
public static void printloop()
{
int i;
for (i=1; i%26lt;9; i++) ;
if (i%2 = = 0) ;
Console.WriteLine (i + " ");
}
a. 2 4 6 8
b. 8
c. Nothing is output.
d. 2 4 6
C# Questions - Please Help ASAP!?
First problem the answer is 4.
Second problem the answer is 8
Third problem the answer is 2, 4, 6, 8.
Why?
1st Problem:
sum 10
i 1
n 3
while i%26lt;=n
{
sum = sum -1
}
output sum
10 - 6 = 4, thats the output of sum
Second problem:
You end up having the value of 4+4 which is 8.
And for the last problem, the only numbers that will give you %2==0 are 2, 4, 6, 8
sending flowers
1. What does the following algorithm produce when n is 3?
set sum to 10.
set i to 1.
input n.
while i is less than or equal to n do
{
take i from sum.
increment i.
}
output sum.
a. 9
b. 7
c. 4
d. 1
2. What would be output by the following section of code ?
int A[4] = {1 , 2, 3, 4};
int i;
for (i=0; i%26lt;4; i++)
{
A[i] = A[i] + A[i];
}
Console.WriteLine (A[i] );
a. 4
b. 0
c. 8
d. 6
3. Given the following method (you may assume it has all compiled correctly so there are no syntax errors), what will be output?
public static void printloop()
{
int i;
for (i=1; i%26lt;9; i++) ;
if (i%2 = = 0) ;
Console.WriteLine (i + " ");
}
a. 2 4 6 8
b. 8
c. Nothing is output.
d. 2 4 6
C# Questions - Please Help ASAP!?
First problem the answer is 4.
Second problem the answer is 8
Third problem the answer is 2, 4, 6, 8.
Why?
1st Problem:
sum 10
i 1
n 3
while i%26lt;=n
{
sum = sum -1
}
output sum
10 - 6 = 4, thats the output of sum
Second problem:
You end up having the value of 4+4 which is 8.
And for the last problem, the only numbers that will give you %2==0 are 2, 4, 6, 8
sending flowers
C++ problem....?
I have this C++ program but when I try to compile it,it says "error C2143: syntax error : missing ';' before '}'"
#include %26lt;iostream%26gt;
using namespace std;
int main()
{
int x = 7;
cout%26lt;%26lt;"try to figure out where are the errors !!!"%26lt;%26lt;endl;
cout%26lt;%26lt;x%26lt;%26lt;endl;
//this is a comment
cout%26lt;%26lt;"bye bye";
cout%26lt;%26lt;"don't forget to solve errors"
}
what am I doing wrong ?
C++ problem....?
Add a semicolon ";" to the end of last line i.e. before the "}" and then recompile.
cout%26lt;%26lt;"don't forget to solve errors";
Hope it helps :)
Reply:cout%26lt;%26lt;"don't forget to solve errors"
semicolon is missing there at the end . :)
Reply:You are missing a ";" after cout%26lt;%26lt;"don't forget to solve errors"
Reply:Put a ; after cout%26lt;%26lt;"don't forget to solve errors"
#include %26lt;iostream%26gt;
using namespace std;
int main()
{
int x = 7;
cout%26lt;%26lt;"try to figure out where are the errors !!!"%26lt;%26lt;endl;
cout%26lt;%26lt;x%26lt;%26lt;endl;
//this is a comment
cout%26lt;%26lt;"bye bye";
cout%26lt;%26lt;"don't forget to solve errors"
}
what am I doing wrong ?
C++ problem....?
Add a semicolon ";" to the end of last line i.e. before the "}" and then recompile.
cout%26lt;%26lt;"don't forget to solve errors";
Hope it helps :)
Reply:cout%26lt;%26lt;"don't forget to solve errors"
semicolon is missing there at the end . :)
Reply:You are missing a ";" after cout%26lt;%26lt;"don't forget to solve errors"
Reply:Put a ; after cout%26lt;%26lt;"don't forget to solve errors"
Is there anyone out there, who is experienced with C#, willing to teach it?
I need to learn networking/server developement mostly, but I'd love to know how to do more with C#. I've got a good logic with it, but the syntax holds me back.
Is there anyone out there, who is experienced with C#, willing to teach it?
That's a large time commitment you're asking for. Why don't you just do what I did -- read some examples, test some things out, read the specification, and start coding?
Ayny particular questions you have you can ask (for example) here, but everything all at once is a little much.
Is there anyone out there, who is experienced with C#, willing to teach it?
That's a large time commitment you're asking for. Why don't you just do what I did -- read some examples, test some things out, read the specification, and start coding?
Ayny particular questions you have you can ask (for example) here, but everything all at once is a little much.
What is difference between "member selection" (.) and "pointer to member" (->) in C++?
This is a very basic C++ question, but help is appreciated.
I'm an experianced VB.net programmer, and want to quickly learn C++. The biggest hurdle at the moment is finding the new syntax and understanding unmanaged pointers - I already understand OOP very well.
Could anyone explain simply what the "pointer to member" operator really is doing? I'm used to only using member selection. Why is a different symbol needed?
What is difference between "member selection" (.) and "pointer to member" (-%26gt;) in C++?
Pointers are one of the most confusing concepts for some people. Not everyone. Just some people. So here is a description of pointers to make sure you get it. It is central to this entire discussion.
You should also know about the %26amp; operand which is used to get the address of something. To get the address of i, you would write %26amp;i. As in:
int i = 10;
int * p = %26amp;i;
now p contains the address of i.
A pointer is a variable that contains an address to memory somewhere on the computer. Let's say i is an integer with a value of 10. That integer lives somewhere in the computer RAM. Lets say it lives at address 5555. If we have a pointer p that points to that integer, then p has a value of 5555.
Great, let's go on.
Let's say there is a structure or class containing an integer i.
so i, is a member of our class. If an instance of that class exists somewhere it has an address. The same address and pointer discussion from before applies. p = 5555, which is the address of the object(instance of class). So we say p points to the object.
This might look like this:
MyClass o = MyClass(); //create object o
MyClass *p = %26amp;o; //get the address of o
Now we want to access the member i of that class. I would put p-%26gt;i to get that value because p is a pointer to the object that contains the member item I want. At any time, you can change p to make it point to some other object.
Member selection using "." is like the original integer discussion using i.
In the original discussion, i was the actual integer. In the same way, if the object is o, then o.i is the member i of object o.
In the example above, p-%26gt;i is refers to the same value as o.i;
Reply:Their is a difference, if the . operator is used, then the memory address that is manipulated is the address of the object being accessed plus the offset where the data is stored. If the -%26gt; operator is used, then the value of the pointer plus the offset is used to access the correct memory location.
Also, in C++ we can overload operators, including -%26gt;, which can allow for some interesting syntax.
Reply:Pointer to member operator (--%26gt;)will call the methods or members at runtime(dynamically). In C++ we have virtual functions . To call those functions we use pointer to member.
Where as we use member selection where call class members at compile time.
I'm an experianced VB.net programmer, and want to quickly learn C++. The biggest hurdle at the moment is finding the new syntax and understanding unmanaged pointers - I already understand OOP very well.
Could anyone explain simply what the "pointer to member" operator really is doing? I'm used to only using member selection. Why is a different symbol needed?
What is difference between "member selection" (.) and "pointer to member" (-%26gt;) in C++?
Pointers are one of the most confusing concepts for some people. Not everyone. Just some people. So here is a description of pointers to make sure you get it. It is central to this entire discussion.
You should also know about the %26amp; operand which is used to get the address of something. To get the address of i, you would write %26amp;i. As in:
int i = 10;
int * p = %26amp;i;
now p contains the address of i.
A pointer is a variable that contains an address to memory somewhere on the computer. Let's say i is an integer with a value of 10. That integer lives somewhere in the computer RAM. Lets say it lives at address 5555. If we have a pointer p that points to that integer, then p has a value of 5555.
Great, let's go on.
Let's say there is a structure or class containing an integer i.
so i, is a member of our class. If an instance of that class exists somewhere it has an address. The same address and pointer discussion from before applies. p = 5555, which is the address of the object(instance of class). So we say p points to the object.
This might look like this:
MyClass o = MyClass(); //create object o
MyClass *p = %26amp;o; //get the address of o
Now we want to access the member i of that class. I would put p-%26gt;i to get that value because p is a pointer to the object that contains the member item I want. At any time, you can change p to make it point to some other object.
Member selection using "." is like the original integer discussion using i.
In the original discussion, i was the actual integer. In the same way, if the object is o, then o.i is the member i of object o.
In the example above, p-%26gt;i is refers to the same value as o.i;
Reply:Their is a difference, if the . operator is used, then the memory address that is manipulated is the address of the object being accessed plus the offset where the data is stored. If the -%26gt; operator is used, then the value of the pointer plus the offset is used to access the correct memory location.
Also, in C++ we can overload operators, including -%26gt;, which can allow for some interesting syntax.
Reply:Pointer to member operator (--%26gt;)will call the methods or members at runtime(dynamically). In C++ we have virtual functions . To call those functions we use pointer to member.
Where as we use member selection where call class members at compile time.
USER LOGIN function in VB.NET (Code Syntax?)?
Hi all, I need help here =/
I need to develop a web based application based on:
- Microsoft's ASP.NET 2.0
- SQL Server 2005
- Programming language is VB.Net
Programs I used are:
- Visual Web Developer 2005 Express Edition
- Microsoft SQL Server Management Studio
Currently I need to do the LOGIN FUNCTION for the user but im not sure how to start. I studied C# in school but my internship company (currently) required me to code in VB.Net and for that I find it very confusing.
Description of what I have:
The main page has a UserID and Password.
- 2 textboxes (and 2 Required Field Validator)
- 1 Login button
- 1 label for Login Error (A login message will be shown if user failed to log in)
- Forget Password Link
The database has a table named User:
- Fields are UserID, Password, .............
*Note* User do not have to register. There is no registration form.
I would like to know how the code syntax is like in VB.NET?
Thanks!
USER LOGIN function in VB.NET (Code Syntax?)?
IMHO, your C# background is awesome and you shouldn't use that as an excuse now. You can do it. Take heart that VB.NET and Visual C#.NET are not really worlds apart since they share the same Base Class Library. Believe it or not, it will be easier for you to learn VB.NET with your C# background than it is for most VB6 developers to transition to VB.NET!
Here's an excellent .NET developers' website that may have some clues for you: http://www.codeproject.com/info/search.a...
Having said that, most of those articles deal with complex forms authentication and role-based security, which is probably beyond what you need. You simply need to validate the user credentials against the db and then allow access (redirect, most likely) to other pages or not.
Let me ask you this: Do you have a good idea how you'd accomplish this in C#? If so, you may want to write out and post some C# pseudocode snippets and see if people can help you translate it to VB.NET. If nothing else, it will help you organize your thoughts.
send flowers
I need to develop a web based application based on:
- Microsoft's ASP.NET 2.0
- SQL Server 2005
- Programming language is VB.Net
Programs I used are:
- Visual Web Developer 2005 Express Edition
- Microsoft SQL Server Management Studio
Currently I need to do the LOGIN FUNCTION for the user but im not sure how to start. I studied C# in school but my internship company (currently) required me to code in VB.Net and for that I find it very confusing.
Description of what I have:
The main page has a UserID and Password.
- 2 textboxes (and 2 Required Field Validator)
- 1 Login button
- 1 label for Login Error (A login message will be shown if user failed to log in)
- Forget Password Link
The database has a table named User:
- Fields are UserID, Password, .............
*Note* User do not have to register. There is no registration form.
I would like to know how the code syntax is like in VB.NET?
Thanks!
USER LOGIN function in VB.NET (Code Syntax?)?
IMHO, your C# background is awesome and you shouldn't use that as an excuse now. You can do it. Take heart that VB.NET and Visual C#.NET are not really worlds apart since they share the same Base Class Library. Believe it or not, it will be easier for you to learn VB.NET with your C# background than it is for most VB6 developers to transition to VB.NET!
Here's an excellent .NET developers' website that may have some clues for you: http://www.codeproject.com/info/search.a...
Having said that, most of those articles deal with complex forms authentication and role-based security, which is probably beyond what you need. You simply need to validate the user credentials against the db and then allow access (redirect, most likely) to other pages or not.
Let me ask you this: Do you have a good idea how you'd accomplish this in C#? If so, you may want to write out and post some C# pseudocode snippets and see if people can help you translate it to VB.NET. If nothing else, it will help you organize your thoughts.
send flowers
C Programming Homework?
Hello. Can somebody help me with this homework in my computer class? I need to submit this tomorrow... Please help me answer these questions: 1. What is the simplest and largest cause of failure in all computer programs? 2. Differentiate syntax error from logical error. 3. Give the symbols used in C programming and their functions. 4. Differentiate Visual Basic from C Programming.
I hope somebody could help me answer at least one question. Many many thanks. :)
C Programming Homework?
1. It's uninitialized memory or so called dangling pointers. But the most dangerous is buffer overflow.
2. Syntax error is when you messed up syntax of the language like when you forget to add ; at the and of the statement. On the other hand logical is when you mess up your algorithm.For example when you want to process array of items and you forget that array is indexed from 0 to length - 1 and your loop looks like
for(i = 0; i %26lt;= LENGTH; i++) { ... }
3. I'm not quite sure if i understand the question but let's try
* - it can dereference pointer or it's multiplication - it depends on the tokens used.
%26amp; - get the address of the variable.
++ - pretty much inc instruction in the asm. So (i++) == (i = i + 1)
-- - same as ++ but for subtraction.
| - bitwise or
%26amp; - bitwise and
|| - logical or
%26amp;%26amp; - logical and
and many others like %26gt;%26gt; %26lt;%26lt; and so on ...
4. Visual basic is high level language used to create GUI application for MS Windows and C is language used for example to write operating systems , compilers and so on. C is harder to use but is more efficient and you have direct access to the hardware. Many of these statements are oversimplified but imo for some homework it's enough :)
Reply:1. The person has no clue what they are doing.
2. Syntax - No real answer. Thats like entering into a calculator: 3.3456.5.3 * 2.
Reply:1. not meeting requirements
2. syntax errors are compiler driven while logical errors are defects of logic.
4. Visual basic allows you to implement object-oriented methodology (includes object definition etc..)
Reply:1. Bad programming, not knowing whta you are doing.
2. Syntax errors won't compile, logical errors will, but produce results that aren't what you are expecting.
3. Another post will have these.
4. C is older, not visual. Visual Basic isn't as powerful, but is easier and more popular in industry.
I hope somebody could help me answer at least one question. Many many thanks. :)
C Programming Homework?
1. It's uninitialized memory or so called dangling pointers. But the most dangerous is buffer overflow.
2. Syntax error is when you messed up syntax of the language like when you forget to add ; at the and of the statement. On the other hand logical is when you mess up your algorithm.For example when you want to process array of items and you forget that array is indexed from 0 to length - 1 and your loop looks like
for(i = 0; i %26lt;= LENGTH; i++) { ... }
3. I'm not quite sure if i understand the question but let's try
* - it can dereference pointer or it's multiplication - it depends on the tokens used.
%26amp; - get the address of the variable.
++ - pretty much inc instruction in the asm. So (i++) == (i = i + 1)
-- - same as ++ but for subtraction.
| - bitwise or
%26amp; - bitwise and
|| - logical or
%26amp;%26amp; - logical and
and many others like %26gt;%26gt; %26lt;%26lt; and so on ...
4. Visual basic is high level language used to create GUI application for MS Windows and C is language used for example to write operating systems , compilers and so on. C is harder to use but is more efficient and you have direct access to the hardware. Many of these statements are oversimplified but imo for some homework it's enough :)
Reply:1. The person has no clue what they are doing.
2. Syntax - No real answer. Thats like entering into a calculator: 3.3456.5.3 * 2.
Reply:1. not meeting requirements
2. syntax errors are compiler driven while logical errors are defects of logic.
4. Visual basic allows you to implement object-oriented methodology (includes object definition etc..)
Reply:1. Bad programming, not knowing whta you are doing.
2. Syntax errors won't compile, logical errors will, but produce results that aren't what you are expecting.
3. Another post will have these.
4. C is older, not visual. Visual Basic isn't as powerful, but is easier and more popular in industry.
What is the BNF and syntax form of this problem?
Determine the BNF and syntax form of adding the first and second digit, multiplying it's sum to the third digit, getting it's qoutient from dividing the product to the 4 digit and subtracting the qoutient to the 5 digit. and getting the form of c=a2=b2/d. thanks.
What is the BNF and syntax form of this problem?
abcde
(a+b)*c\d - e
What is the BNF and syntax form of this problem?
abcde
(a+b)*c\d - e
What is the proper syntax for commands in the RUN dialog box for Windows?
I keep trying different commands, but for each command, the command window just opens up for less than a second, then closes. Why does it do this, or what am I typing wrong in the dialog box? Here's an example:
cmd [/c] [/t:fg]
this command is supposed to change the foreground and background colors for the command window, but I keep getting the message:
Not recognized as internal or external command, operable program or batch file.
How can I use the command function properly with the correct syntax?
What is the proper syntax for commands in the RUN dialog box for Windows?
If you're trying to open a command window and have it look a certain way, then you'll definitely have to change the syntax a bit. So, let's look at what you're doing first. I'm going to assume that the command line you've given us is literally what you're typing in the 'run' box. Let's break it down a bit,
1) cmd
If you enter this by itself, does a DOS command window open? If not, then you have some other issues. But for the sake of this question, I'll assume it works.
2) cmd [/C] [/T:fg]
Get rid of any and all square brackets [ ] .. those are used on the help screen to delimit the start and stop of the different command line options. They are not meant to be typed in.
3) cmd /C
This will execute whatever you want in a DOS command window, then immediately close the command window. That's why it's disappearing so quickly. If you want the DOS window to stay open then use,
cmd /K
4) /T:fg
The 'fg' are placeholder variables. 'f' means Foregroud, and 'g' means backGround. But 'fg' is not supposed to be typed in, it's just meant to show that there are two variables and their order. To actually use the /T option, then you'll need to look at the options on the COLOR command, use COLOR /? to see those.
So, for instance, if you wanted a blue background with white text, then you would enter
cmd /T:17
5) One last quirk, if you put the command and options in this order, you'll get an error.
cmd /K /T:17
The command options need to be switched around for this. I don't know why, has to do with how DOS processes the ":" symbol as a label or part of a drive name, or some such nonsense.
So the correct command with options to create a non-closing DOS window with a blue background and white text is:
cmd /T:17 /K
Finally) if you want your chosen colors to be persistent any time you open a dos window without have to type all those command options, then open a window with just
cmd
then, right click on the title bar of the DOS window and select "Properties". Make all the changes you want to many aspects of a DOS box, including background/font color, size, fonts, layout, etc. When you click "OK" to save, then you'll be prompted to save the properties .. choose "Save properties for future windows with the same title."
Hope this helps!
Reply:I think the run box is just for running programs, particularly older programs that operated only on a command line operating system like DOS. So commands like:
"C:\Program Files\Adobe\photoshop 5.0\Photoshp.exe" work OK.
What you are trying to do will probably work in command prompt which comes in accessories in the program section of windows XP (I think it is in other older windows systems too) and is a DOS emulator.
Reply:Type cmd /? and it will give you the syntax and options.
cmd [/c] [/t:fg]
this command is supposed to change the foreground and background colors for the command window, but I keep getting the message:
Not recognized as internal or external command, operable program or batch file.
How can I use the command function properly with the correct syntax?
What is the proper syntax for commands in the RUN dialog box for Windows?
If you're trying to open a command window and have it look a certain way, then you'll definitely have to change the syntax a bit. So, let's look at what you're doing first. I'm going to assume that the command line you've given us is literally what you're typing in the 'run' box. Let's break it down a bit,
1) cmd
If you enter this by itself, does a DOS command window open? If not, then you have some other issues. But for the sake of this question, I'll assume it works.
2) cmd [/C] [/T:fg]
Get rid of any and all square brackets [ ] .. those are used on the help screen to delimit the start and stop of the different command line options. They are not meant to be typed in.
3) cmd /C
This will execute whatever you want in a DOS command window, then immediately close the command window. That's why it's disappearing so quickly. If you want the DOS window to stay open then use,
cmd /K
4) /T:fg
The 'fg' are placeholder variables. 'f' means Foregroud, and 'g' means backGround. But 'fg' is not supposed to be typed in, it's just meant to show that there are two variables and their order. To actually use the /T option, then you'll need to look at the options on the COLOR command, use COLOR /? to see those.
So, for instance, if you wanted a blue background with white text, then you would enter
cmd /T:17
5) One last quirk, if you put the command and options in this order, you'll get an error.
cmd /K /T:17
The command options need to be switched around for this. I don't know why, has to do with how DOS processes the ":" symbol as a label or part of a drive name, or some such nonsense.
So the correct command with options to create a non-closing DOS window with a blue background and white text is:
cmd /T:17 /K
Finally) if you want your chosen colors to be persistent any time you open a dos window without have to type all those command options, then open a window with just
cmd
then, right click on the title bar of the DOS window and select "Properties". Make all the changes you want to many aspects of a DOS box, including background/font color, size, fonts, layout, etc. When you click "OK" to save, then you'll be prompted to save the properties .. choose "Save properties for future windows with the same title."
Hope this helps!
Reply:I think the run box is just for running programs, particularly older programs that operated only on a command line operating system like DOS. So commands like:
"C:\Program Files\Adobe\photoshop 5.0\Photoshp.exe" work OK.
What you are trying to do will probably work in command prompt which comes in accessories in the program section of windows XP (I think it is in other older windows systems too) and is a DOS emulator.
Reply:Type cmd /? and it will give you the syntax and options.
When i include iostream.h in my c++ program i get errors. what should i do?
error is C:\TC\INCLUDE\IOSTREAM.H 38:declaration syntax error
i include the file like #include%26lt;iostream.h%26gt;
my turbo c++ version is 1.01
When i include iostream.h in my c++ program i get errors. what should i do?
maybe... u didn't put any space between include and %26lt;iostream%26gt;...
example:
#include %26lt;iostream.h%26gt;
hope this will help you...
quince
i include the file like #include%26lt;iostream.h%26gt;
my turbo c++ version is 1.01
When i include iostream.h in my c++ program i get errors. what should i do?
maybe... u didn't put any space between include and %26lt;iostream%26gt;...
example:
#include %26lt;iostream.h%26gt;
hope this will help you...
quince
How to make a program in C++(turbo c++) that can do addition with the given of two integers?
how to make a program in C++(turbo c++) that can do addition with the given of two integers?
I know this is odd but i just want to know how?what if I want to compute 3 integers or 4? How do I do it?
by the way I'm a beginner. Plese don't tell me to find it in the internet because I've already did it. the syntax is different because were using a very old turbo c++ compiler (v1.01)
post the program here...thanks
How to make a program in C++(turbo c++) that can do addition with the given of two integers?
#include%26lt;iostream%26gt;
using namespace std;
int main(int argc, char **argv)
{
int a,b,c,i;
int g=2;
c=0;
for (i = 0; i%26lt;g; i++)
{
cout %26lt;%26lt; "get number";
cin %26gt;%26gt; a;
c = c+a;
}
cout %26lt;%26lt; "number is " %26lt;%26lt; c;
}
just change the number 2 with the number of integets you want to add
I know this is odd but i just want to know how?what if I want to compute 3 integers or 4? How do I do it?
by the way I'm a beginner. Plese don't tell me to find it in the internet because I've already did it. the syntax is different because were using a very old turbo c++ compiler (v1.01)
post the program here...thanks
How to make a program in C++(turbo c++) that can do addition with the given of two integers?
#include%26lt;iostream%26gt;
using namespace std;
int main(int argc, char **argv)
{
int a,b,c,i;
int g=2;
c=0;
for (i = 0; i%26lt;g; i++)
{
cout %26lt;%26lt; "get number";
cin %26gt;%26gt; a;
c = c+a;
}
cout %26lt;%26lt; "number is " %26lt;%26lt; c;
}
just change the number 2 with the number of integets you want to add
What the proper syntax to delete Norton Goback completely using either command console or command prompt?
I have 160 gigabyte internal hard drive, I was using for logical storage. Ever since I stored Goback on it, my primary c drive could no longer read it as a storage drive. It is like the 160 gigabyte hard drive is useless. Even when I try it in other machines it is not recognized. Goback tries to start, but then I get an error message saying there is no operating system to start Goback. I’m not able to install the operating system unless I can get this hard disk changed to primary.
There is over 40 unused gigabytes (on this 160 gigabyte internal hard drive) for which an operating system could be loaded if I could partition the hard drive.
So I purchased Norton PartitionMagic to do the partition. Norton PartitionMagic
says I cannot make any changes to my partition because GoBack is detected. It says to disable Goback then restart PartitionMagic. If there were an operating system installed on this disk I could disable Goback. Goback tries to start. Then the error message says “operating system not found”
What the proper syntax to delete Norton Goback completely using either command console or command prompt? I believe if I could delete GoBack, then I could work on all my other problems, and get this hard drive partitioned, so I can load and operating system on it.
I’ve never tried to use Norton tech support. I’m sure they are closed now, but are they helpful?
What the proper syntax to delete Norton Goback completely using either command console or command prompt?
There is an easer way to Totally remove Goback form your Master Boot Record (MBR).
As your machine is rebooting, hold down "CTRL" and "ALT" don't let go. Press "G" key count to 10, release, then hold again the "G" key, count to 10 release, hold again, count to 10, release. It takes about 3 reboots. Finally you will get the screen you are waiting for. It warns you are about to remove Goback form your MBR. It says press any key to cancel, or press "F" to totally remove Goback form your from your MBR.
Reply:If you intend to format, use the gold old fdisk, It does not know or care what is on the partition before deleating it
There is over 40 unused gigabytes (on this 160 gigabyte internal hard drive) for which an operating system could be loaded if I could partition the hard drive.
So I purchased Norton PartitionMagic to do the partition. Norton PartitionMagic
says I cannot make any changes to my partition because GoBack is detected. It says to disable Goback then restart PartitionMagic. If there were an operating system installed on this disk I could disable Goback. Goback tries to start. Then the error message says “operating system not found”
What the proper syntax to delete Norton Goback completely using either command console or command prompt? I believe if I could delete GoBack, then I could work on all my other problems, and get this hard drive partitioned, so I can load and operating system on it.
I’ve never tried to use Norton tech support. I’m sure they are closed now, but are they helpful?
What the proper syntax to delete Norton Goback completely using either command console or command prompt?
There is an easer way to Totally remove Goback form your Master Boot Record (MBR).
As your machine is rebooting, hold down "CTRL" and "ALT" don't let go. Press "G" key count to 10, release, then hold again the "G" key, count to 10 release, hold again, count to 10, release. It takes about 3 reboots. Finally you will get the screen you are waiting for. It warns you are about to remove Goback form your MBR. It says press any key to cancel, or press "F" to totally remove Goback form your from your MBR.
Reply:If you intend to format, use the gold old fdisk, It does not know or care what is on the partition before deleating it
XML - XPath syntax help?
Say you have an XML file that looks like this:
%26lt;KW%26gt;
%26lt;Subjects SubjectID="00100" SubjectDescription="ABORTION"/%26gt;
%26lt;Subjects SubjectID="00010" SubjectDescription="ABUSE * ADULT * INVESTIGATION"/%26gt;
%26lt;Subjects SubjectID="06450" SubjectDescription="ABUSE * CHILD ABUSE * COUNSELING"/%26gt;
%26lt;/KW%26gt;
I'm trying to configure the XPath property of a C# XMLDataSource object so that I can grab the rows in this XML file for which the SubjectDescription contains a given search criteria. For example, if the criteria were "ABUSE", the last two rows of the XML would be returned as a result set.
What exact XPath syntax would perform this query?
XML - XPath syntax help?
I am working on something like this to answer but this isn't right yet:
//KW/Subjects[starts-with(@SubjectDesc...
%26lt;KW%26gt;
%26lt;Subjects SubjectID="00100" SubjectDescription="ABORTION"/%26gt;
%26lt;Subjects SubjectID="00010" SubjectDescription="ABUSE * ADULT * INVESTIGATION"/%26gt;
%26lt;Subjects SubjectID="06450" SubjectDescription="ABUSE * CHILD ABUSE * COUNSELING"/%26gt;
%26lt;/KW%26gt;
I'm trying to configure the XPath property of a C# XMLDataSource object so that I can grab the rows in this XML file for which the SubjectDescription contains a given search criteria. For example, if the criteria were "ABUSE", the last two rows of the XML would be returned as a result set.
What exact XPath syntax would perform this query?
XML - XPath syntax help?
I am working on something like this to answer but this isn't right yet:
//KW/Subjects[starts-with(@SubjectDesc...
Turbo c help?
in a turbo c program i have typed a program . There is no syntax error but when i try to compile there shows error a message comes (unable to open input file "cos.obj")
What should do to compile the program sucessfully ?
Turbo c help?
Here's some material on Turbo C, not sure if it's going to be much help.
http://www.brackeen.com/vga/trouble.html...
Most of my C programming was in a Unix environment were we just wrote programs using the vi editor and compiled them with cc.
garden centre
What should do to compile the program sucessfully ?
Turbo c help?
Here's some material on Turbo C, not sure if it's going to be much help.
http://www.brackeen.com/vga/trouble.html...
Most of my C programming was in a Unix environment were we just wrote programs using the vi editor and compiled them with cc.
garden centre
Addition of integers in C++?
I am trying to write a program that takes in 5 numbers from a user and then add the numbers to get the sum.
I declared
int a,b,c,d,e,sum; so that those would be my varibles.
I get all the numbers typed in in the program but the addition part makes no sense.
I tried
%d=%d+%d+%d+%d+%d, %26amp;sum, %26amp;a, %26amp;b, %26amp;c, %26amp;d, %26amp;e;
I get a bunch of errors saying syntax error found. found 'd' expecting";"
Your help is greatly appreciated.
Addition of integers in C++?
You seem to be mistaking the printf statements of "%d=%d+%d+%d+%d+%d", %26amp;sum, %26amp;a, %26amp;b, %26amp;c, %26amp;d, %26amp;e being valid for if and for statements, etc. The printf statements only work with printf.
Similar to your other question, you only need to use the variables themselves.
sum = a + b + c + d + e;
You will probably only want to display the sum, so use
printf( "%d", sum);
Reply:What are you using to comile? Visual studio or? Try www.programmersheaven.com for some help.
Reply:what is this % sign for? %26amp; sign means the address of a variable in memory.
here is what you may want:
int main()
{
int a,b,c,d,e,sum;
// the part which takes in 5 numbers
sum=a+b+c+d+e;
// print out
return 0;
}
Reply:is that supposed to be a printf? lose the address refs in your variables. (get rid of the "%26amp;"s)
sum = a+b+c+d+e;
printf("%d = %d + %d + %d + %d + %d", sum, a, b, c, d, e);
I declared
int a,b,c,d,e,sum; so that those would be my varibles.
I get all the numbers typed in in the program but the addition part makes no sense.
I tried
%d=%d+%d+%d+%d+%d, %26amp;sum, %26amp;a, %26amp;b, %26amp;c, %26amp;d, %26amp;e;
I get a bunch of errors saying syntax error found. found 'd' expecting";"
Your help is greatly appreciated.
Addition of integers in C++?
You seem to be mistaking the printf statements of "%d=%d+%d+%d+%d+%d", %26amp;sum, %26amp;a, %26amp;b, %26amp;c, %26amp;d, %26amp;e being valid for if and for statements, etc. The printf statements only work with printf.
Similar to your other question, you only need to use the variables themselves.
sum = a + b + c + d + e;
You will probably only want to display the sum, so use
printf( "%d", sum);
Reply:What are you using to comile? Visual studio or? Try www.programmersheaven.com for some help.
Reply:what is this % sign for? %26amp; sign means the address of a variable in memory.
here is what you may want:
int main()
{
int a,b,c,d,e,sum;
// the part which takes in 5 numbers
sum=a+b+c+d+e;
// print out
return 0;
}
Reply:is that supposed to be a printf? lose the address refs in your variables. (get rid of the "%26amp;"s)
sum = a+b+c+d+e;
printf("%d = %d + %d + %d + %d + %d", sum, a, b, c, d, e);
How to execute c program in gcc compiler under windows OS?
I have started to use a gcc compiler (cygwin and mingw) recently. Iam unable to compile and execute programs thorough it. Can somebody tell me where to save the c/c++ files in order to get them compiled and the syntax needed to compile and run them. I would be thankful if someone also provides some links which could help me to get familiar with the gcc compiler.
How to execute c program in gcc compiler under windows OS?
When installing cygwin it doesnt automatically come with gcc. You have to tell it to install it. Its been a while, but basically when you are installing cygwin, you have to hit custom or something and select the packages to install. There are a lot but somewhere you should find one where you can select gcc, makefile, and whatever else you may need.
You can then call gcc as normal.
How to execute c program in gcc compiler under windows OS?
When installing cygwin it doesnt automatically come with gcc. You have to tell it to install it. Its been a while, but basically when you are installing cygwin, you have to hit custom or something and select the packages to install. There are a lot but somewhere you should find one where you can select gcc, makefile, and whatever else you may need.
You can then call gcc as normal.
Are J# (.NET) syntax and library references exactly the same as standard Sun JAVA?
I only as because I'm using JSC to compile java files that I've compiled previously with javac, but am getting all sorts of weird error messages about missing ';' and '%26gt;' characters.
%26lt;code%26gt;
C:\%26gt;jsc JSCTest.java
Microsoft (R) JScript Compiler version 8.00.50727
for Microsoft (R) .NET Framework version 2.0.50727
Copyright (C) Microsoft Corporation 1996-2005. All rights reserved.
JSCTest.java(5,35) : error JS1193: Expected ',' or ')'
JSCTest.java(5,40) : error JS1002: Syntax error
%26lt;/code%26gt;
what am I doing wrong?
Are J# (.NET) syntax and library references exactly the same as standard Sun JAVA?
No, J# is not the same as standard Sun Java; problems compiling conformant Java code under J# are not at all uncommon.
But I don't think that is your problem here. It looks like you are using the JavaScript compiler, not the Java compiler. Java and JavaScript are not the same thing at all!
You should download the latest Java developer's kit from http://java.sun.com and use the "javac" command contained therein to compile your Java code.
%26lt;code%26gt;
C:\%26gt;jsc JSCTest.java
Microsoft (R) JScript Compiler version 8.00.50727
for Microsoft (R) .NET Framework version 2.0.50727
Copyright (C) Microsoft Corporation 1996-2005. All rights reserved.
JSCTest.java(5,35) : error JS1193: Expected ',' or ')'
JSCTest.java(5,40) : error JS1002: Syntax error
%26lt;/code%26gt;
what am I doing wrong?
Are J# (.NET) syntax and library references exactly the same as standard Sun JAVA?
No, J# is not the same as standard Sun Java; problems compiling conformant Java code under J# are not at all uncommon.
But I don't think that is your problem here. It looks like you are using the JavaScript compiler, not the Java compiler. Java and JavaScript are not the same thing at all!
You should download the latest Java developer's kit from http://java.sun.com and use the "javac" command contained therein to compile your Java code.
How to write an exponetial equation in C code/language?
i am trying to define the following funtion in C code could some please tell me the exact syntax on how to declare this
f(x) = e^(-x^2)
this is how someone told me to do it but it doesnt work
#include(math.h)
y= exp(-x,2)
How to write an exponetial equation in C code/language?
the function is
pow(base, exponent);
and you DO have to include math.h
First define e
const float e = 2.78; //proabably want to be more exact
int x;
x = 10;
pow(e, pow(x, 2)); //This caluculates e to the value of x (which is 10) squared.
Reply:exp(pow(-x,2));
flower show
f(x) = e^(-x^2)
this is how someone told me to do it but it doesnt work
#include(math.h)
y= exp(-x,2)
How to write an exponetial equation in C code/language?
the function is
pow(base, exponent);
and you DO have to include math.h
First define e
const float e = 2.78; //proabably want to be more exact
int x;
x = 10;
pow(e, pow(x, 2)); //This caluculates e to the value of x (which is 10) squared.
Reply:exp(pow(-x,2));
flower show
If bluej is for java,what is for C++?
I just want to get the answer as fast as I can.,If we use bluej to compile java syntax,what are we going to use for C++?
If bluej is for java,what is for C++?
Not quite sure, but look up Poseidon.
Also, look up Bloodshed Dev C++ and Eclipse with the C++ plug-in.
Reply:bluej supports C\C++.
Reply:Microsoft Visual C++ Express Edition, it's free and seems to have quite a few features.
http://msdn.microsoft.com/vstudio/expres...
Good luck with your c++ programming!
If bluej is for java,what is for C++?
Not quite sure, but look up Poseidon.
Also, look up Bloodshed Dev C++ and Eclipse with the C++ plug-in.
Reply:bluej supports C\C++.
Reply:Microsoft Visual C++ Express Edition, it's free and seems to have quite a few features.
http://msdn.microsoft.com/vstudio/expres...
Good luck with your c++ programming!
What is the new syntax of "clrscr()"?
What is the new or the latest syntax of clrscr()? For example, when I use it in Dev-C++? Or according to Walter Savitch's Second Edition Book? Give as many as you can... thank you very much....
What is the new syntax of "clrscr()"?
Windows
system("cls");
Unix
system("clear");
Reply:Since clrscr(), which is part of conio.h, is a non-standard C or C++ function, you'll have to look up how Borland has it implemented. As I recall, it's nothing more than clrscr() by itself.
What is the new syntax of "clrscr()"?
Windows
system("cls");
Unix
system("clear");
Reply:Since clrscr(), which is part of conio.h, is a non-standard C or C++ function, you'll have to look up how Borland has it implemented. As I recall, it's nothing more than clrscr() by itself.
How to write DllImport kernel32 in C++.net unmanaged code?
Can someone tell me syntax for importing SetEnvironmentVariable from kernel32.dll in C++ unmanaged code.
How to write DllImport kernel32 in C++.net unmanaged code?
check out http://www.pscode.com - site with good examples
Reply:Wow...I have no clue what you're talking about. LOL.
How to write DllImport kernel32 in C++.net unmanaged code?
check out http://www.pscode.com - site with good examples
Reply:Wow...I have no clue what you're talking about. LOL.
Is there a commond for give a printout commond in DOS mode C language?
i make a project for printing the bill of medicins and i want to give a commond to this. what is the commond. please send with the syntax. the whole program in DOS mode C lanuage i.e; C using graphics.
Is there a commond for give a printout commond in DOS mode C language?
Research fprint()
Reply:i think freopen() can help u.
use it to print the file.
Reply:printf();
Use this command
phone cards
Is there a commond for give a printout commond in DOS mode C language?
Research fprint()
Reply:i think freopen() can help u.
use it to print the file.
Reply:printf();
Use this command
phone cards
Sunday, July 12, 2009
I want to read a c++ source code and then read the output of it from visual C++ 2005.?
I dont know the syntax for reading the output of the C++ code. Please help me.
I want to read a c++ source code and then read the output of it from visual C++ 2005.?
Find it from stroustrup's C++ book. Alternaively consult a C++ expert.
I want to read a c++ source code and then read the output of it from visual C++ 2005.?
Find it from stroustrup's C++ book. Alternaively consult a C++ expert.
MySQL 'INTO OUTFILE' path syntax in Windows?
When I am querying like:
SELECT * FROM table1 WHERE name LIKE '%some%' INTO OUTFILE 'C:\\bun.xls';
from a remote computer the output file: 'bun.xls' is saved in the server, and not in the local C of the remote computer. Why? Is it really like this?
What should I do in order to save/download the table data from the server to local C of the remote computer? Is there a correct syntax for path in Windows like the proper way to use // or the \ or /'s?
IIf the file already exists, how can I overwrite it? Can I also append data to the existing file? How?
O my God, I'm asking too much.... sorry. Pls help...
MySQL 'INTO OUTFILE' path syntax in Windows?
I don't know? Are you sure you can forcibly transfer a file into someone's computer?... Maybe you need to escape your slashes...? =S
SELECT * FROM table1 WHERE name LIKE '%some%' INTO OUTFILE 'C:\\bun.xls';
from a remote computer the output file: 'bun.xls' is saved in the server, and not in the local C of the remote computer. Why? Is it really like this?
What should I do in order to save/download the table data from the server to local C of the remote computer? Is there a correct syntax for path in Windows like the proper way to use // or the \ or /'s?
IIf the file already exists, how can I overwrite it? Can I also append data to the existing file? How?
O my God, I'm asking too much.... sorry. Pls help...
MySQL 'INTO OUTFILE' path syntax in Windows?
I don't know? Are you sure you can forcibly transfer a file into someone's computer?... Maybe you need to escape your slashes...? =S
Can someone explain to me the function strxfrm() in C++?
I am a beginner in C++ but would like to know the syntax, explanation, simple sample program and expected output in using strxfrm() in C++. Please explain it to me very briefly since I am just a beginner.
Can someone explain to me the function strxfrm() in C++?
strxfrm()
transform string
Function
SYNOPSIS DESCRIPTION PARAMETERS RETURN VALUES CONFORMANCE MULTITHREAD SAFETY LEVEL PORTING ISSUES AVAILABILITY SEE ALSO
--------------------------------------...
SYNOPSIS
#include %26lt;string.h%26gt;
size_t strxfrm(char *s1, const char *s2, size_t n);
--------------------------------------...
DESCRIPTION
The strxfrm() function transforms the string pointed to by s2 so that strcmp() can be used for lexical comparisons, taking into consideration the value of LC_COLLATE. The transformations performed by strxfrm() are such that, if two strings are transformed, the lexical relationship of the transformed strings as determined by strcmp() is the same as the lexical relationship of the original strings as determined by strcoll(). The transformed string is placed into the buffer pointed to by s1.
If n is zero, then s1 may be null. In this case, strxfrm() returns the number of characters in s2 it would transform. The terminating null-character is not included.
For the C locale, strxfrm() is equivalent to:
strncpy(s1, s2, n);
return strlen(s1);
--------------------------------------...
PARAMETERS
s1
Either NULL, or a pointer to a buffer to receive the transformed string.
s2
Points to a null-terminated string to be transformed for collating.
n
Is the maximum number of characters to transform.
--------------------------------------...
RETURN VALUES
The strxfrm() function returns the length of the transformed string, excluding the terminating null character. If the value returned is n or more, the contents of the array pointed to by s1 are undetermined.
If strxfrm() encounters a character outside of the collating sequence defined for the current locale, it sets errno to EINVAL.
--------------------------------------...
CONFORMANCE
ANSI/ISO 9899-1990.
--------------------------------------...
MULTITHREAD SAFETY LEVEL
MT-Safe, with exceptions.
This function is MT-Safe as long as no thread calls setlocale() while this function is exec
Reply:it downloads pornography
Can someone explain to me the function strxfrm() in C++?
strxfrm()
transform string
Function
SYNOPSIS DESCRIPTION PARAMETERS RETURN VALUES CONFORMANCE MULTITHREAD SAFETY LEVEL PORTING ISSUES AVAILABILITY SEE ALSO
--------------------------------------...
SYNOPSIS
#include %26lt;string.h%26gt;
size_t strxfrm(char *s1, const char *s2, size_t n);
--------------------------------------...
DESCRIPTION
The strxfrm() function transforms the string pointed to by s2 so that strcmp() can be used for lexical comparisons, taking into consideration the value of LC_COLLATE. The transformations performed by strxfrm() are such that, if two strings are transformed, the lexical relationship of the transformed strings as determined by strcmp() is the same as the lexical relationship of the original strings as determined by strcoll(). The transformed string is placed into the buffer pointed to by s1.
If n is zero, then s1 may be null. In this case, strxfrm() returns the number of characters in s2 it would transform. The terminating null-character is not included.
For the C locale, strxfrm() is equivalent to:
strncpy(s1, s2, n);
return strlen(s1);
--------------------------------------...
PARAMETERS
s1
Either NULL, or a pointer to a buffer to receive the transformed string.
s2
Points to a null-terminated string to be transformed for collating.
n
Is the maximum number of characters to transform.
--------------------------------------...
RETURN VALUES
The strxfrm() function returns the length of the transformed string, excluding the terminating null character. If the value returned is n or more, the contents of the array pointed to by s1 are undetermined.
If strxfrm() encounters a character outside of the collating sequence defined for the current locale, it sets errno to EINVAL.
--------------------------------------...
CONFORMANCE
ANSI/ISO 9899-1990.
--------------------------------------...
MULTITHREAD SAFETY LEVEL
MT-Safe, with exceptions.
This function is MT-Safe as long as no thread calls setlocale() while this function is exec
Reply:it downloads pornography
Subscribe to:
Posts (Atom)