The issue that I'm having is that when I run this part of the code it seems to enter the if statement and set it to 0 when comparing the array to the input.
What I want it to do is to search the array for the grade, set it to zero, and then exit the loop in case there are any repeat grades. It always sets the first number to 0 and then exits.
//Below is the prototyping for the array
int grades[14] = {60,50,50,20,75,90,0,0,0,0,0,0,0,0};
//There is some code between here, but it is probably not relevant so I didn't post it.
printf("Enter the grade that you want to remove. Press Enter after each input."); printf("Enter 0 to exit: ");
[Code] ....
I didn't mean to leave the "prototyping" part in the code. I was initially going to put the function prototypes in there, but decided it wasn't necessary for the question.
I'm looking for a algorithm to search portions of string that have the same caracter. The only possible values are: a,n and g
Char index: 0 1 2 3 4 5 6 7 8 9 RESULT ------------------------------------------ Example 1: a g g g a a 0,4 Example 2: g g g a n n a 0,3 Example 3: a g g g g g g a 0,7 Example 4: g g g g g g g 0,6 Example 5: g g a a g a a a g 0,2,3,5,7,8
I'm working on a homework project, and it requires me to read in a file of chars into an array, and then do stuff with that array.
Anyways, I have the first part written, where I'm just trying to read in my data.txt file, and I thought I had it written well. It compiles, but then it seg faults, and I'm not sure why. I used calloc for the array, but maybe I misused it? Or is it in my EOF statement? I'm still not sure if that's coded correctly. I need to get past this so I can start testing the other parts of my code.
Code: #include <stdio.h> #include <stdlib.h>
int main(int argc, char* argv[] ) { /* Local Declarations*/ int i; int *ptr; char tempc;
I am trying to convert some chars to UTF-8 strings...
Example:
std::string gethex(char c) { /* EXAMPLE if (c == 'é') return "%c3%a9"; I need a function that converts chars like "á, é, í, ã" to UTF-8 hexadecimal strings... */ }
[Code] .....
[URL] .... does it. Choose UTF-8, type some character and click 'Url Encode'.
I'm writing a school assignment that writes/reads user input into and out of a binary file.
I've gotten the write part to work, but now I need to be able to read that file back in and display it as a string.
I think I should be using fread() and read my file into an array of int's right? But when I try printing out that array I get a whole bunch of numbers that don't match the hex code in my file.
How do I read in a binary file and print it out as a string?
(below) on a website which is used for printing the characters as the keys on keyboard are hit i-e without hitting the ENTER key. This method is used in a while loop like this
Code: while ((c = win_getch()) != 13) {}
I wanted to know why is the character compared to
Code: 13 i-e Code: if((c = win_getch()) != 13) then do something
Code: /** * This function will simulate the getch() function from conio.h. * Note that this does not work for special keys like F1-F12, arrow keys, * even the ESC key does not seem to work with this function. * @return TCHAR read from input buffer. */ TCHAR win_getch() { DWORD mode; TCHAR theChar = 0;
As a part of a program I am supposed to write, I would like to receive a string from the user (for example: "Hi my name is Joe").
obviously, the string is inserted to an array of chars (arr[0]='H', arr[1]='i', arr[2]=' ',... and so on).
What I would like to do, is to put each word separately in each array cell (for example arr[0]='Hi', arr[1]="my"..., and so on). How can I do this? (I can not use any functions, unless I write them myself).
How to give input with text for this function.i already create function for this but i dn't know give input as non ASCII value(0-32) that Cobain with string or simple text.
For some reason my code is not couting right. My function is supposed to decipher some code that if it has multiple same chars then it drops one. Example aabbyfkk --------> abyfk. But it couts abyffkk . For some reason it is not getting rid of the extra f and k chars.
string decrypt (string encrypted) { string deleted, tmp; int i, pos, n, j=0, z; tmp=encrypted;
I was supposed to sort out an input, getting rid of chars and only using the numbers. So 5a6g7we87hj9 would become 567879. I might be wrong in some way, but I used
I am trying to make a for loop that will print out chars in an array while using a #define before main. My problem is that each name has a different amount of chars in it. How do you account for that when you are trying to define a size? For example, I am playing around with the numbers and I just put 7 in for size:
I'm trying to right the function that puts the correct letters in the right positons being reported from my previous compareletter function for my game of hang man and its not updating the word in progress array. Here's my compare letter function that's working correctly:
Code: //function that returns the index of the letter that the user has guessed or Code: //-1 if the letter isn't in the word int CompareLetter(char array[], char guess, int numLetters) { int i;
[Code....
However, this isn't changing any of the position of the asterisks in the word in progress array positions 0-3.
That code should make the size of the pointer (how many chars it can store) bigger but when i run it it show always 3 char positions while it should show N*M.
Code: #include <stdio.h>#include <stdlib.h> int main(void) { int M, N, P, i; scanf ("%d %d", &M, &N); P = M * N; char *c = malloc(P * sizeof(char));
Write a program that reads a group of chars till $. Then, compute # of vowels, # of digits, # of word and # of special chars. Your program should display all required results.
How do I detect garbage chars in a CString. Actually I'm reading some data from COM port. In some certain condition it will give some garbage as a version no. Now I need to show _T("N/A") in case of there is any garbage.
My solution is to check for a Valid char or integer. If found its correct else Garbage.
I'm supposed to create a program that will find the min/max values of two ints, doubles, and chars, It's not completely done but here's what I have so far.
It's giving me an Error 1 error LNK2019: unresolved external symbol "public: __thiscall MinMax<int>::MinMax<int>(int,int)" (??0?$MinMax@H@@QAE@HH@Z) referenced in function _mainC:UsersDerickDesktopCiss243Week3 Assignment2Week3 Assignment2Main.objWeek3 Assignment2
Header file #ifndef MINMAX_H #define MINMAX_H #include <iostream> using namespace std; template <class T> class MinMax
[Code] ....
I don't know why the site is adding in extra bits of code like /> in certain areas, it's not there when I paste it in and it's not in my code ....