Anonymous
Anonymous
Hello everyone,i have one question,2148,2159 Stock Exchange:
The stock data should be read from a text file containing the following data: stock code, stock name, amount invested
(xxx.xx), shares held, and current price. Use the Internet or your local paper to gather data on at least 20 stocks. As each stock is read, insert it into a doubly linked multilinked list.The first logical list should be ordered on the stock code. The
second logical list should be ordered on the gain or loss for the
stock. Gain or loss is calculated as the current value of the stock
(shares held times current price) minus the amount invested.
Include at least one loss in your test data.
After building the lists, display a menu that allows the user to
display each logical list forward or backward (a total of four
options). Each display should contain an appropriate heading
and column captions.
Prepare a list of your input data and a printout of each display option.
klimi
it's hard to explain shortly
Talula
Thread mean
Thread is like operating System creates threads, it talks to the program on that thread...
So each program by default get a single thread, the program can request more when it needs to do multiple things at a single time.
You must've heard multi threaded...
But sometimes, you want to change the variable in a different thread and it can be seen by other threads too, this is where you declare volatile.
klimi
(or you want it to be changed by some interrupt)
Talula
klimi
:D i put it in brackets!
Nana
Hello does anyone have answers to tony gaddis programming challenges for chapter 10 of his c++ book?
Anonymous
Hey what are constant, volatile and constant volatile variables
Volatile in C++ would be used only if you are doing Low level or hardware programming. You won't use it anywhere else. Since C++ has its own memory model now and since C++ doesn't define memory semantics of volatiles in a multi threaded environment,you shouldn't use volatile to enforce ordering semantics in a multi threaded program. So like O said before,volatile should be used only if you are doing hardware programming.
const is just a way of enforcing that the variable won't be changed by your program.
const volatile means that your program won't change the value but it can be changed outside of your program.
coal
i would like to add that since C++11 the standard describes and supports multi-threading
coal
so multi-threading in older versions of C++ isnt specified by the standard
Azhar
how can reverse user input string with Preserving position of Space in C programming ?
Azhar
how can reverse user input string with Preserving position of Space in C programming ?
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char * strrevLoc(char *str, int starLoc, int endLoc){
while(starLoc<endLoc){
char temp = str[endLoc];
str[endLoc] = str[starLoc];
str[starLoc] = temp;
starLoc++;
endLoc--;
}
return str;
}
/*
gnimmargorP C gninrael era eW
*/
char * strrevWords(char *str){
int startLoc = 0, endLoc = 0;
while(endLoc<=strlen(str)){
if(str[endLoc]==' ' || str[endLoc]=='\0'){
strrevLoc(str, startLoc, endLoc-1);
puts(str);
startLoc = endLoc+1;
printf("\n%c",str[endLoc]);
}
endLoc++;
}
}
int main(){
char *ptr = NULL;
int i = 0;
while(1){
char temp = getchar();
i++;
if(temp=='\n'){
break;
}
else if(i>1){
ptr = (char *) realloc(ptr, i*sizeof(char));
*(ptr+i) = temp;
}
else{
ptr = (char *)malloc(1);
*ptr = temp;
}
}
/*char str[30] = "We are learning C Programming";
printf("%s\n",strrevLoc(str,0, strlen(str)-1));
strrevWords(str);
puts(str);*/
//printf("")
puts(ptr);
free(ptr);
ptr = NULL;
}
Whats wrong with code?
Anonymous
so multi-threading in older versions of C++ isnt specified by the standard
That is what I meant when I said "C++ has its own memory model now". But even with C++1*/C++2*, volatiles don't have any memory model specific sections in the standard. As such there is no memory ordering semantics associated with that (as was mentioned wrongly by some other person). Volatile can't be used in a safe manner in multithreaded environments unless supported by other synchronisation primitives.
olli
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char * strrevLoc(char *str, int starLoc, int endLoc){
while(starLoc<endLoc){
char temp = str[endLoc];
str[endLoc] = str[starLoc];
str[starLoc] = temp;
starLoc++;
endLoc--;
}
return str;
}
/*
gnimmargorP C gninrael era eW
*/
char * strrevWords(char *str){
int startLoc = 0, endLoc = 0;
while(endLoc<=strlen(str)){
if(str[endLoc]==' ' || str[endLoc]=='\0'){
strrevLoc(str, startLoc, endLoc-1);
puts(str);
startLoc = endLoc+1;
printf("\n%c",str[endLoc]);
}
endLoc++;
}
}
int main(){
char *ptr = NULL;
int i = 0;
while(1){
char temp = getchar();
i++;
if(temp=='\n'){
break;
}
else if(i>1){
ptr = (char *) realloc(ptr, i*sizeof(char));
*(ptr+i) = temp;
}
else{
ptr = (char *)malloc(1);
*ptr = temp;
}
}
/*char str[30] = "We are learning C Programming";
printf("%s\n",strrevLoc(str,0, strlen(str)-1));
strrevWords(str);
puts(str);*/
//printf("")
puts(ptr);
free(ptr);
ptr = NULL;
}
Whats wrong with code?
what does not work?
Felix
What do we need if we want to make an API?
Talula
Mr
Faisal ahmed Faisal
Write a program to create a class called C, the class has members, T, E, Y, and M a constructor to assign values, and member function to display the result of the following equation:
Faisal ahmed Faisal
How ?c++
klimi
which part you don't understand?
Faisal ahmed Faisal
Where is equation
Faisal ahmed Faisal
I think question not complete
Nameful
Faisal ahmed Faisal
Yea
klimi
it seems like it
mayway
Can u recommend me good cpp book??pdf??
Mr
Define server.
Server means VPS, where automatic programs/scripts will run when requested
olli
Anonymous
Hello iam civil branch now I completed my B.E but I can go to software field than how to start ?
Anonymous
Now I like software
Talula
Now I like software
You could try programming out and if you feel you should go ahead into it, do it, otherwise don't waste your time with it.
Anonymous
klimi
read a book, articles, watch some videos...
Anonymous
Ok
Mr
Anonymous
How to learn any course link please
Mr
Anonymous
Ok
Medi
Hi, i have a problem while reading a txt file in c using fscanf funtion, im new into c language
Medi
I have this txt file CAMPEONATO SEVERIANO BALLESTEROS 3 4 5 5 4 4 3 3 4 3 4 5 5 3 3 4 3 4
11 María Luisa López Fresno 01/07/1990 4 6 8 5 3 4 4 4 6 3 4 4 5 3 3 4 3 4
14 Juan Castillo Jiménez 08/07/2000 -1
0 Sergio Garcia 31/10/1987 3 3 4 5
8 Sara Crespo López 08/07/1973 3 4 5 5 6 6 4 and im using this pattern to try to get it while (fscanf (fichero, "%s\t%s\t%s\n",&nombre&a,&b,&c >1))
Medi
anyone know how can i get the name of the person right? thanks in advance
Talula
Anonymous
Yo
Anonymous
Anyone can teach me how program that counts the number of characters in input?
Mehul
Dima
don’t ever ask python people, everything is going to be hard for them lol
Sñeha
Haha
Dima
c++ is going to be easy after 10 years of using it or so
Anonymous
Anonymous
What about normal variable...
Anonymous
Can they also be changed in thread ??
Anonymous
Hello, everyone! Can someone help me with an iterative program? It would mean a lot to me :((
Anonymous
It's about the padovan sequence
arfa
how to change color of button in graphics when clicked in C programming
Dr
Sñeha
I'm so happy😍🤓😀😌
Dr
Python (despite being made from C) has a lot of abstraction so it’s easier to code
Dr
You can directly dive into python without knowing any programming lang
Dr
But if you’re aiming for competitive programming go with C++
Dr
Execution is faster
Dr
To be frank build strong problem solving skills - language doesn’t matter much! If you get the logic right you’ll ace it! Only syntax varies in each language
......
Write a program using a suitable data structure using Linked implementation to evaluate Boolean expressions such as the one shown next:
(T | T) & F & (F | T)
where T is for true and F is for false. The expressions may include the following operators: “!” for not, “&” for and, and “|” for or; the use of parentheses for operations grouping is also allowed. To perform the evaluation of an expression, you will consider the priority of the operators, the not having the highest and the or the lowest. The program must yield T or F as the result for each expression in the input file.
Input:
A variable length expression.
Output:
The result of the expression evaluation, for example: (T | T) & F & (F | T) will produce F.
____________________________________________________________________
Sñeha
Thanks for clearing my Confusion.. DR
Dr
And each language comes with its own pros and cons
......
......
??
Talula
Can they also be changed in thread ??
You can change a normal variable inside the thread but not in external thread... like you could create 100s of threads to handle let us say to find the right IP address.
So let us say you ping it and if it replies you call a port and see if it returns a value... if you do this in a normal single threaded program and let us say you have a time out of 2 seconds, you'll end up with 512 seconds of program waiting.
But if you do it using threading, all threads will ping and same thing, your program will finish in 2 seconds... but let us say you have a variable that has information about what to send to the IP... if you keep it in a normal variable you can't access it from the other thread, it has to be volatile.
Rahul
Flying balloons animation program code
Anonymous
Hi again! I would like to ask for help in making an iterative program about the padovan sequence in c. I'm having trouble especially in the for loop part
coal
coal
for example, Python for loops are expressions
coal
the thing i most felt strange about python was this syntax:
mylist = [
num
for num in numbers if num > 2
]
coal
the variable you're pulling from the loop, comes before the loop
coal
it was a huge ??? for me, but no issue in the long term