@deceptikon
That's the point. How does an uppercase function work when its used with utf8? A uppercase function would be pretty simple arithmetic with ASCII values but I fail to see how that function would work with utf8.
@deceptikon
That's the point. How does an uppercase function work when its used with utf8? A uppercase function would be pretty simple arithmetic with ASCII values but I fail to see how that function would work with utf8.
I have a simple question about unicode and utf8.
How does a utf8 encoding know what its uppercase encoding is? I understand how utf8 encoding carries its unicode value embedded in itself but I fail to see how it maps a utf8 encoding to an uppercase unicode value. What is the mechanism which maps utf8 encodings to uppercase encodings or the other features available in the unicode universe?
Or posting in the wrong section?
I think you are confused. First you write the program and then you post it with any problems you are having.
Ok, which functions and line numbers are you talking about?
The solution or hints of a solution depend on which data structures you plan to use. Could you post what you have so far?
Shouldn't this
scanf("%s", &employeeIDNew);
be
scanf("%s", employeeIDNew);
Well 3 divided by 5 has 3 left over. The modulus operator computes the remainder of integer division.
I guess you are not aware of our homework policy.
We don't do homework problems.
If you want help with a specific problem then you'll have to post the code and indicate exactly where and what the problem is.
The difference between a democracy and a dictatorship is that in a democracy you vote first and take orders later; in a dictatorship you don't have to waste your time voting.
Charles Bukowski
You can set the delimiter for getline().
istream& getline (istream& is, string& str, char delim);
Please check out this link
http://www.cplusplus.com/reference/string/string/getline/
Can you post your code?
Do you mean something like this?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char**argv)
{
/*make sure str1 is padded with enough room*/
char str1[] = {'H','e','l','l','o',',',' ','W','o','r','l','d','\0',' ',' ', ' ', ' ', ' ', ' '};
char str2[] = "this is more text";
fprintf(stdout, "str1->%s\n", str1);
fprintf(stdout, "str2->%s\n", str2);
/*append text*/
strcat(str1, &str2[12]);
fprintf(stdout, "str1->%s\n", str1);
exit(EXIT_SUCCESS);
}
How can i do it?
Depends. Do you want to overwrite the characters or do you want to insert the characters and shift everything down..
Actually, what is going on here?
void toss(int & x)
//0=heads 1=tails
x=rand()%2;
int result(int a, int b, int c)
{
...
}
You seem to be missing the opening brace here
void toss(int & x)//missing brace here
//0=heads 1=tails
x=rand()%2;
Are you sure the datafile is in the same folder as the executable.
Did you pass std::endl or "\n" to std::cout?
Try running this program with your data.
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char** argv)
{
ifstream names;
names.open("P25.txt");
string data;
while(names >> data)
{
cout << "You read->" << data << "<-into data!" << std::endl;
}
names.close();
return 0;
}
Here you go....
#include <stdio.h>
#define ARR_SIZE 10
int main()
{
size_t i = 0;
char chr_arr[ARR_SIZE];
/*populate int_arr*/
for (; i < ARR_SIZE; ++i)
{
if (chr_arr[i] /*meets some condition*/)
{
}
}
return 0;
}
Now lets see you write the condition part and populate the array.
C++ is a play on the C programming language increment operator. C++ literally means C language incremented.
What's the purpose of it? Here check the wiki
Here's some links you might want to read...
http://linuxgazette.net/issue77/krishnakumar.html
http://www.acm.uiuc.edu/sigops/roll_your_own/
OK. What have you tried so far?
Yes, you will searching for the element contained in the array std. If you need to search id in the array std then you could loop through std and check each id.
size_t i = 0;
for (; i < 100; ++i)
{
if (std[i].id == some_int)
{
//do something here
}
}
Well first you have to identify which platform this OS will run on and then you have to brush up on that platform's assembler code.
Could you please give more details?
I think you can use any compiler which has the ability modify the linker, GNU's compiler has linker scripts which controls this important aspect.
Well this is how you access an element of std[100] and get its elements.
std[searchid].id
std[searchid].name
std[searchid].fatherName
std[searchid].motherName
Try reopening the input file or setting the file position back to the beginning with fseek() on line 22.
Thanks. I didn't realize the software section had a generic top-level which caught everything in the software section.
I'm curious as to where a member would post a question on ML(Ocaml) type language?
If you insists on breaking out of the loop immediately then you should use break.
Something like this...
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int employeeNumber = 0;
while( true )
{
cout << "\nEmplyee Number: ";
cin >> employeeNumber;
cout << endl;
if ( employeeNumber == 0 ) break;
while( true )
{
cout << "Inner loop\n";
//do something here
}
}
cout << "Done" << endl;
return 0;
}
Shouldn't this have a semi-colon after it?
struct item { int* num ; int* q; };//semi-colon
Why are the structure elements pointers? If you insist on pointers then you'll have to allocate memory for them or point them to valid memory before you use them.
If you want to save yourself some frustration then don't include this in your header file
using namespace std;
Header files shouldn't expose anything in a namespace.
I'm pretty sure the standard says something about modifying the value past to the function in for_each(). If you want to change a value past to a function then I would investigate the transform() function.
Oops. My bad, I was thinking about something else. Please ignore.
This forums provides help to users who have specific questions. It isn't a free programming advice column.
Could you elaborate on your question?
I have a question about this line
scanf("%d", &val);
Why are you reading a integer into a character? Won't it make more sense to read the characters directly into the character array?
scanf("%20s", a);
Did you try the function tolower()? You could apply this to each character and perform any calculations to the result.
Well what do you need help with? Please post the code you attempted and highlight any sections and explain the problems.
I'm at a complete lose as to what you are trying to accomplish here...
Try looking at the function here:
#include <iostream>
using namespace std;
int ture ( int a[], int b[], int d);
int main ()
{
int b [5]={1,2,3,4,5};
int a [5] ={1,2,3,4,5};
cout << ture(b, a, 5) << endl;
}
int ture ( int a[], int b[], int d)
{
for (int i = 0; i < d; i++)
{
if (a[i] != b[i])
{
return false;
}
}
return true;
}
The arrays are fine! Do you have another problem with the code?
Doesn't this for loop run past your arrays?
for (int d = 0; d < 10; d++)//arrays have five elements
{
...
}
This function returns int but you return boolean inside the function. What does this function accomplish?
int ture ( int a[], int b[], int d)
{
const double NUM = 10;
for (int d = 0; d < 10; d++)
{
if (a[d] != b[d])
{
return false;
}
}
return true;
}
I would have to say that you need a flagging system which marks a integer element when its been counted.
Are you sure this is C?
for(int i = 0; i < 10; i++)
{
...
}
Number one. Why all the semi-colons?
Here. Can you spot the error now?
class Timerange
{
public:
Timerange(string initstring)
{
string current = "";
unsigned short mode = 0;
string timeA;
string weekday;
string timeB;
for(unsigned short i = 0; i<initstring.length(); i++)
{
char c = initstring[i];
if (c == ' ')
{
};//hint its here
else
{
}
}
}
};
Looking at your code I find that you have to make a decision. Do you want to calculate the average once and store the value in the structure Student or do you want to calculate the student average each time you need it.
void Print_List(Student List[], int Size)
{
cout <<left << fixed << setprecision(2) <<showpoint <<endl ;
cout << setw(19) << "Name"
<< setw(18) << "ID"
<< setw(18) << "Average"
<< setw(16) << "Grade" << endl;
cout << "=============================================================" << endl;
for(int i = 0; i < Size;i++)
cout << setw(19) << List[i].LastName +", "+ List[i].FirstName
<< setw(18) << List[i].Id
<< setw(20) << calcAverage(List[i])//I use the return value here but it also stores the result in student
<< List[i].Grade << endl;
}
OK. What compiler and IDE are you using?
Did you check that the compiler was C++? It may be defaulting to C. I know NetBeans - C\C++ plugin will do this sometines.
Are you sure your compiling this with a C++ compiler? Could you be using a C compiler?
Try something like this.
void displayTruck()
{
for (size_t i = 0; i < counter; ++i)
std::cout << itemPtr[i]->getMaker() << itemPtr[i]->getCost() << std::endl;
}